API Reference



Mod Fix


RemapService

class RemapService(path: str | None = None, keepBackups: bool = True, fixOnly: bool = False, undoOnly: bool = False, readAllInis: bool = False, types: List[str] | None = None, defaultType: str | None = None, log: str | None = None, verbose: bool = True, handleExceptions: bool = False, version: str | None = None, remappedTypes: List[str] | None = None)

The overall class for remapping modss

Parameters:
  • path (Optional[str]) –

    The file location of where to run the fix.

    If this attribute is set to None, then will run the fix from wherever this class is called

    Default: None

  • keepBackups (bool) –

    Whether to keep backup versions of any .ini files that the script fixes

    Default: True

  • fixOnly (bool) –

    Whether to only fix the mods without removing any previous changes this fix script may have made

    Warning

    if this is set to True and undoOnly is also set to True, then the fix will not run and will throw a ConflictingOptions exception


    Default: False

  • undoOnly (bool) –

    Whether to only undo the fixes previously made by the fix

    Warning

    if this is set to True and fixOnly is also set to True, then the fix will not run and will throw a ConflictingOptions exception


    Default: True

  • readAllInis (bool) –

    Whether to read all the .ini files that the fix encounters

    Default: False

  • types (Optional[List[str]]) –

    The names for all the types of mods to fix.

    If this argument is an empty list or this argument is None, then will fix all the types of mods supported by this fix

    Default: None


    Note

    For more information about the available mod names/aliases to reference and the format to specify this argument, see Mod Types

  • remappedTypes (Optional[List[str]]) –

    The names for the types of mods to be remapped based from the types of mods specified at RemapService.types.

    For a mod specified at RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified at RemapService.types to all its corresponding mods to remap.

    If this argument is an empty list or this argument is None, then will fix the mods specified at RemapService.types to all of their corresponding remapped mods

    eg. if RemapService.types is ["Kequeen", "jean"] and this attribute is ["jeanSea"], then this class will perform the following remaps:

    • Keqing –> KeqingOpulent

    • Jean –> JeanSea

    **Note: ** Jean –> JeanCN will not be remapped for the above example

    Default: None

  • defaultType (Optional[str]) –

    The name for the type to use if a mod has an unidentified type

    If this value is None, then mods with unidentified types will be skipped

    Default: None

  • log (Optional[str]) –

    The folder location to log the run of the fix into a seperate text file

    If this value is None, then will not log the fix

    Default: None

  • verbose (bool) –

    Whether to print the progress for fixing mods

    Default: True

  • handleExceptions (bool) –

    When an exception is caught, whether to silently stop running the fix

    Default: False

  • version (Optional[str]) –

    The game version we want the fix to be compatible with

    If This value is None, then will retrieve the hashes/indices of the latest version.

    Default: None

_loggerBasePrefix

The prefix string for the logger used when the fix returns back to the original directory that it started to run

Type:

str

logger

The logger used to pretty print messages

Type:

Logger

_path

The file location of where to run the fix.

Type:

str

keepBackups

Whether to keep backup versions of any .ini files that the script fixes

Type:

bool

fixOnly

Whether to only fix the mods without removing any previous changes this fix script may have made

Type:

bool

undoOnly

Whether to only undo the fixes previously made by the fix

Type:

bool

readAllInis

Whether to read all the .ini files that the fix encounters

Type:

bool

types

All the types of mods that will be fixed.

Type:

Set[ModType]

remappedTypes

The names for the types of mods to be remapped based from the types of mods specified at RemapService.types.

For a mod specified at RemapService.types, if none of its corresponding mods to remap are specified in this attribute, then will remap the mod specified at RemapService.types to all its corresponding mods to remap.

If this argument is an empty list or this argument is None, then will fix the mods specified at RemapService.types to all of their corresponding remapped mods

eg. if RemapService.types is ["Kequeen", "jean"] and this attribute is ["jeanSea"], then this class will perform the following remaps:

  • Keqing –> KeqingOpulent

  • Jean –> JeanSea

**Note: ** Jean –> JeanCN will not be remapped for the above example

Type:

Set[str]

defaultType

The type to use if a mod has an unidentified type

Type:

Optional[ModType]

verbose

Whether to print the progress for fixing mods

Type:

bool

version

The game version we want the fix to be compatible with

If This value is None, then will retrieve the hashes/indices of the latest version.

Type:

Optional[float]

handleExceptions

When an exception is caught, whether to silently stop running the fix

Type:

bool

_logFile

The file path of where to generate a log .txt file

Type:

str

_pathIsCWD

Whether the filepath that the program runs from is the current directory where this module is loaded

Type:

bool

blendStats

Stats about whether some Blend.buf files got fixed/skipped/removed

Note

  • removed Blend.buf files refer to RemapBlend.buf files that were previously made by this software on a previous run

Type:

FileStats

iniStats

Stats about whether some .ini files got fixed/skipped/undoed

Note

  • The skipped .ini files may or may not have been previously fixed. A path to some .ini file in this attribute DOES NOT imply that the .ini file previously had a fix

Type:

FileStats

modStats

Stats about whether a mod has been fixed/skipped

Type:

FileStats

texAddStats

Stats about whether an existing texture file has been editted/removed

Type:

FileStats

texEditStats

Stats about whether some brand new texture file created by this software has been created/removed

Type:

FileStats

_fix()

The overall logic for fixing a bunch of mods

For finding out which folders may contain mods, this function:
  1. recursively searches all folders from where the RemapService.path is located

  2. for every .ini file in a valid mod and every Blend.buf file encountered that is encountered, recursively search all the folders from where the .ini file or Blend.buf file is located

Tip

For more info about how we define a ‘mod’, go to Mod

_printModsToFix()

Prints out the types of mods that will be fixed

_setupDefaultModType()

Sets the default mod type to be used for an unidentified mod

_setupLogPath()

Sets the folder path for where the log file will be stored

_setupModPath()

Sets the filepath of where the fix will run from

_setupModTypes(attr: str)

Sets the types of mods that will be fixed / fix to

Parameters:

attr (str) – The name of the attribute within this class set the mods for

_setupRemappedTypes()

Sets the names for the types of mods that will be fixed to

_setupVersion()

Sets the game version to fix to

addTips()

Prints out any useful tips for the user to know

clear(clearLog: bool = True)

Clears up all the saved data

Paramters

clearLog: bool

Whether to also clear out any saved data in the logger

createLog()

Creates a log text file that contains all the text printed on the command line

createMod(path: str | None = None, files: List[str] | None = None) Mod

Creates a mod

Tip

For more info about how we define a ‘mod’, go to Mod

Parameters:
  • path (Optional[str]) –

    The absolute path to the mod folder.

    If this argument is set to None, then will use the current directory of where this module is loaded

  • files (Optional[List[str]]) –

    The direct children files to the mod folder (does not include files located in a folder within the mod folder).

    If this parameter is set to None, then the module will search the folders for you

Returns:

The mod that has been created

Return type:

Mod

fix()

Fixes a bunch of mods

see _fix() for more info

fixIni(ini: IniFile, mod: Mod) bool

Fixes an individual .ini file for a particular mod

Tip

For more info about how we define a ‘mod’, go to Mod

Parameters:
  • ini (IniFile) – The .ini file to fix

  • mod (Mod) – The mod being fixed

Returns:

Whether the particular .ini file has just been fixed

Return type:

bool

fixMod(mod: Mod) bool

Fixes a particular mod

Tip

For more info about how we define a ‘mod’, go to Mod

Parameters:

mod (Mod) – The mod being fixed

Returns:

Whether the particular mod has just been fixed

Return type:

bool

property log: str

The folder location to log the run of the fix into a seperate text file

Getter:

Returns the file path to the log

Setter:

Sets the path for the log

Type:

str

property path: str

The filepath of where the fix is running from

Getter:

Returns the path of where the fix is running

Setter:

Sets the path for where the fix runs

Type:

str

property pathIsCwd

Whether the filepath that the program runs from is the current directory where this module is loaded

Getter:

Returns whether the filepath that the program runs from is the current directory of where the module is loaded

Type:

bool

reportSkippedAsset(assetName: str, assetDict: Dict[str, Exception], warnStrFunc: Callable[[str], str])

Prints out the exception message for why a particular .ini file or Blend.buf file has been skipped

Parameters:
  • assetName (str) – The name for the type of asset (files, folders, mods, etc…) that was skipped

  • assetDict (Dict[str, Exception]) –

    Locations of where exceptions have occured for the particular asset

    The keys are the absolute folder paths to where the exception occured

  • wantStrFunc (Callable[[str], str]) –

    Function for how we want to print out the warning for each exception

    Takes in the folder location of where the exception occured as a parameter

reportSkippedMods()

Prints out all of the mods that were skipped due to exceptions

Tip

For more info about how we define a ‘mod’, go to Mod

warnSkippedIniResource(modPath: str)

Prints out all of the resource files from the .ini files that were skipped due to exceptions

Parameters:

modPath (str) – The absolute path to a particular folder


Mod

class Mod(path: str | None = None, files: List[str] | None = None, logger: Logger | None = None, types: Set[ModType] | None = None, defaultType: ModType | None = None, version: float | None = None, remappedTypes: Set[str] | None = None)

This Class inherits from Model

Used for handling a mod

Note

We define a mod based off the following criteria:

  • A folder that contains at least 1 .ini file

  • At least 1 of the .ini files in the folder contains:

    • a section with the regex [TextureOverride.*Blend] if RemapService.readAllInis is set to True or the script is ran with the --all flag

      OR

    • a section that meets the criteria of one of the mod types defined Mod._types by running the mod types’ ModType.isType() function


See ModTypes for some predefined types of mods

Parameters:
  • path (Optional[str]) –

    The file location to the mod folder.

    If this value is set to None, then will use the current directory of where this module is loaded.

    Default: None

  • files (Optional[List[str]]) –

    The direct children files to the mod folder (does not include files located in a folder within the mod folder).

    If this parameter is set to None, then the class will search the files for you when the class initializes

    Default: None

  • logger (Optional[Logger]) –

    The logger used to pretty print messages

    Default: None

  • types (Optional[Set[ModType]]) –

    The types of mods this mod should be.

    If this argument is empty or is None, then all the .ini files in this mod will be parsed

    Default: None

  • remappedTypes (Optional[Set[ModType]]) –

    The types of mods to the mods specified at Mod._types will be fixed to.

    Note

    For more details, see RemapService.remappedTypes

    Default: None

  • defaultType (Optional[ModType]) –

    The type of mod to use if a mod has an unidentified type

    If this argument is None, then will skip the mod with an identified type

    Default: None

  • version (Optional[float]) –

    The game version we want the fixed mod

    If This value is None, then will fix the mod to using the latest hashes/indices.

path

The file location to the mod folder

Type:

Optional[str]

version

The game version we want the fixed mod

Type:

Optional[float]

_files

The direct children files to the mod folder (does not include files located in a folder within the mod folder).

Type:

List[str]

_types

The types of mods this mod should be

Type:

Set[ModType]

_remappedType

The types of mods to the mods specified at Mod.types will be fixed to.

Note

For more details, see RemapService.remappedTypes

Type:

Set[str]

_defaultType

The type of mod to use if a mod has an unidentified type

Type:

Optional[ModType]

logger

The logger used to pretty print messages

Type:

Optional[Logger]

inis

The .ini files found for the mod

The keys are the file paths to the .ini file

Type:

Dict[str, IniFile]

remapBlend

The RemapBlend.buf files found for the mod

Type:

List[str]

backupInis

The DISABLED_RemapBackup.txt files found for the mod

Type:

List[str]

remapCopies

The remapFix.ini files found for the mod

Type:

List[str]

remapTextures

The remapFix.dds files found for the mod

Type:

List[str]

_removeIniResources(ini: IniFile, result: Set[str], resourceName: str, resourceStats: FileStats, getIniResources: Callable[[IniFile], List[IniResourceModel]]) bool

Removes a particular type of resource from a .ini file

Parameters:
  • ini (IniFile) – The particular .ini file to be processed

  • result (Set[str]) – The resultant paths to the resources that got removed

  • resourceName (str) – The name of the type of resource

  • resourceStats (FileStats) – The associated statistical data for the resource type

  • getIniResource (Callable[[IniFile], List[IniResourceModel]]) – The function to retrieve the data related to the resource from the .ini file

Returns:

Whether there was a file that was attempted to be removed

Return type:

bool

_setupFiles()

Searches the direct children files to the mod folder if Mod.files is set to None

classmethod blendCorrection(blendFile: str | bytes, modType: ModType, modToFix: str, fixedBlendFile: str | None = None, version: float | None = None) str | None | bytearray

Fixes a Blend.buf file

See BlendFile.correct() for more info

Parameters:
  • blendFile (Union[str, bytes]) – The file path to the Blend.buf file to fix

  • modType (ModType) – The type of mod to fix from

  • modToFix (str) – The name of the mod to fix to

  • fixedBlendFile (Optional[str]) –

    The file path for the fixed Blend.buf file

    Default: None

  • version (Optional[float]) –

    The game version to fix to

    If this value is None, then will fix to the latest game version

    Default: None

Raises:
  • BlendFileNotRecognized – If the original Blend.buf file provided by the parameter blendFile cannot be read

  • BadBlendData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file

Returns:

If the argument fixedBlendFile is None, then will return an array of bytes for the fixed Blend.buf file

Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected

Return type:

Union[Optional[str], bytearray]

correctBlend(blendStats: FileStats, iniPaths: List[str] | None = None, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]

Fixes all the Blend.buf files reference by the mod

Requires all the .ini files in the mod to have ran their IniFile.parse() function

Parameters:
  • blendStats (FileStats) – The stats to keep track of whether the particular the blend.buf files have been fixed or skipped

  • iniPaths (Optional[List[str]]) –

    The file paths to the .ini file to have their blend.buf files corrected. If this value is None, then will correct all the .ini file in the mod

    Default: None

  • fixOnly (bool) –

    Whether to not correct some Blend.buf file if its corresponding RemapBlend.buf already exists

    Default: True

Returns:

  1. The absolute file paths of the RemapBlend.buf files that were fixed

  2. The exceptions encountered when trying to fix some RemapBlend.buf files

The keys are absolute filepath to the RemapBlend.buf file and the values are the exception encountered

Return type:

[Set[str], Dict[str, Exception]]

correctResource(resourceStats: FileStats, getResourceModels: Callable[[IniFile], List[IniResourceModel]], correctFile: Callable[[str, str, ModType, str, int, IniResourceModel], str], iniPaths: List[str] | None = None, fileTypeName: str = '', needsSrcFile: bool = True, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]

Fixes all the files for a particular type of resource referenced by the mod

Requires all the .ini files in the mod to have ran their IniFile.parse() function

Parameters:
  • resourceStats (FileStats) – The stats to keep track of whether the particular resource has been fixed or skipped

  • getResourceModels (Callable[[IniFile], List[IniResourceModel]]) – Function to retrieve all of the needed IniResourceModel from some .ini file

  • correctFile (Callable[[str, str, ModType, str, int, IniResourceModel], str]) –

    Function to fix up the resource file

    The parameters for the function are as follows:

    1. The full file path to the original resource

    2. The fixed file path to the resource

    3. The type of mod being fixed within the .ini file

    4. The name of the mod to fix to

    5. The index of the part within the IfTemplate

    6. The index of the path within the particular part of the IfTemplate

    7. The version of the game to fix to

    8. The current IniResourceModel being processed



    The function returns a str with the fixed file path to the resource

  • iniPaths (Optional[List[str]]) –

    The file paths to the .ini file to have their resources corrected. If this value is None, then will correct all the .ini file in the mod

    Default: None

  • fileTypeName (str) – The name of the file resource

  • fixOnly (bool) –

    Whether to not correct some Blend.buf file if its corresponding RemapBlend.buf already exists

    Default: True

Returns:

  1. The absolute file paths of the RemapBlend.buf files that were fixed

  2. The exceptions encountered when trying to fix some RemapBlend.buf files

The keys are absolute filepath to the RemapBlend.buf file and the values are the exception encountered

Return type:

[Set[str], Dict[str, Exception]]

correctTex(texAddStats: FileStats, texEditStats: FileStats, iniPaths: List[str] | None = None, fixOnly: bool = False) List[Set[str] | Dict[str, Exception]]

Fixes all the texture .dds files reference by the mods

Requires all the .ini files in the mod to have ran their IniFile.fix() function

Parameters:
  • texAddStats (FileStats) – The stats to keep track of whether the particular .dds file have been newly created or skipped

  • texEditStats (FileStats) – The stats to keep track of whether the particular .dds file has been editted or skipped

  • iniPaths (Optional[List[str]]) –

    The file paths to the .ini file to have their .dds files corrected. If this value is None, then will correct all the .ini file in the mod

    Default: None

  • fixOnly (bool) –

    Whether to not correct some .dds file if its corresponding RemapTex.dds already exists

    Default: True

Returns:

  1. The absolute file paths of the .dds files that were added

  2. The exceptions encountered when trying to created some .dds files

  3. The absolute file paths of the .dds files that were editted

  4. The exceptions encountered when trying to edit some .dds files

For the exceptions, the keys are absolute filepath to the .dds file and the values are the exception encountered

Return type:

[Set[str], Dict[str, Exception], Set[str], Dict[str, Exception]]

property files

The direct children files to the mod folder (does not include files located in a folder within the mod folder).

Getter:

Returns the files to the mod

Setter:

Sets up the files for the mod

Type:

Optional[List[str]]

getOptionalFiles() List[str | None]

Retrieves a list of each type of files that are not mandatory for the mod

Returns:

The resultant files found for the following file categories (listed in the same order as the return type):

  1. .ini files not created by this fix

  2. .RemapBlend.buf files

  3. DISABLED_RemapBackup.txt files

  4. RemapFix.ini files

Note

See Mod.isIni(), Mod.isRemapBlend(), Mod.isBackupIni(), Mod.isRemapCopyIni() for the specifics of each type of file

Return type:

[ List[str], List[str], List[str]]

classmethod isBackupIni(file: str) bool

Determines whether the file is a DISABLED_RemapBackup.txt file that is used to make backup copies of .ini files

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a DISABLED_RemapBackup.txt file

Return type:

bool

classmethod isBlend(file: str) bool

Determines whether the file is a Blend.buf file which is the original blend file provided in the mod

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a Blend.buf file

Return type:

bool

classmethod isIni(file: str) bool

Determines whether the file is a .ini file which is the file used to control how a mod behaves

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a .ini file

Return type:

bool

classmethod isRemapBlend(file: str) bool

Determines whether the file is a RemapBlend.buf file which is the fixed Blend.buf file created by this fix

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a RemapBlend.buf file

Return type:

bool

classmethod isRemapCopyIni(file: str) bool

Determines whether the file is RemapFix.ini file which are .ini files generated by this fix to remap specific type of mods

*eg. mods such as Keqing or Jean that are fixed by GIMIObjMergeFixer *

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a RemapFix.ini file

Return type:

bool

classmethod isRemapTexture(file: str) bool

Determines whether the file is a RemapTex.dds file which are texture .dds files generated by this fix to edit a particular texture file for some specific type of mods

*eg. mods such as Kirara or Nilou that are fixed by GIMIRegEditFixer *

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a RemapTex.dds file

Return type:

bool

classmethod isSrcIni(file: str) bool

Determines whether the file is a .ini file that is not created by this fix

Parameters:

file (str) – The file path to check

Returns:

Whether the passed in file is a .ini file not created by this fix

Return type:

bool

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any

removeBackupInis()

Removes all DISABLED_RemapBackup.txt contained in the mod

removeFix(blendStats: FileStats, iniStats: FileStats, texStats: FileStats, keepBackups: bool = True, fixOnly: bool = False, readAllInis: bool = False) List[Set[str]]

Removes any previous changes done by this module’s fix

Parameters:
  • blendStats (FileStats) – The data about Blend.buf files

  • iniStats (FileStats) – The data about .ini files

  • texStats (FileStats) – The data about .dds files

  • keepBackups (bool) –

    Whether to create or keep DISABLED_RemapBackup.txt files in the mod

    Default: True

  • fixOnly (bool) –

    Whether to not undo any changes created in the .ini files

    Default: False

  • readAllInis (bool) –

    Whether to remove the .ini fix from all the .ini files encountered

    Default: False

Returns:

The removed files that have their fix removed, where the types of files for the return value is based on the list below:

  1. .ini files with their fix removed

  2. RemapBlend.buf files that got deleted

  3. RemapTex.dds files that got deleted

Return type:

[Set[str], Set[str], Set[str]]

removeRemapCopies()

Removes all RemapFix.ini files contained in the mod

classmethod texCorrection(fixedTexFile: str, texEditor: BaseTexEditor, texFile: str | None = None) str | None

Fixes a .dds file

Parameters:
  • fixedTexFile (str) – The name of the file path to the fixed RemapTex.dds file

  • texEditor (BaseTexEditor) – The texture editor to change the texture file

:param texFile Optional[str]: The file path to the original texture .dds file

If this value is None, then will use ‘fixedTexFile’ as the original file path to the texture .dds file (usually this case for creating a brand new .dds file by also passing in object of type TexCreator into the ‘texEditor’ argument)

Default: None


ModType

class ModType(name: str, check: str | Pattern | Callable[[str], bool], hashes: Hashes | None, indices: Indices | None = None, aliases: List[str] | None = None, vgRemaps: VGRemaps | None = None, iniParseBuilder: IniParseBuilder | None = None, iniFixBuilder: IniFixBuilder | None = None, iniRemoveBuilder: IniRemoveBuilder | None = None)

Class for defining a generic type of mod

Parameters:
  • name (str) – The default name for the type of mod

  • check (Union[str, Pattern, Callable[[str], bool]]) –

    The specific check used to identify the .ini file belongs to the specific type of mod when checking arbitrary line in a .ini file

    1. If this argument is a string, then will check if a line in the .ini file equals to this argument

    2. If this argument is a regex pattern, then will check if a line in the .ini file matches this regex pattern

    3. If this argument is a function, then will check if a line in the .ini file will make the function for this argument return True

  • hashes (Optional[Hashes]) –

    The hashes related to the mod and its fix

    If this value is None, then will create a new, empty Hashes

    Default: None

  • indices (Optional[Indices]) –

    The indices related to the mod and its fix

    If this None, then will create a new, emtpy Indices

    Default: None

  • aliases (Optional[List[str]]) –

    Other alternative names for the type of mod

    Default: None

  • vgRemaps (Optional[VGRemaps]) –

    Maps the blend indices from the vertex group of one mod to another mod

    If this value is None, then will create a new, empty VGRemaps

    Default: None

  • iniParseBuilder (Optional[IniParseBuilder]) –

    The builder to build the parser used for .ini files

    If this value is None, then by default this attribute will be set to IniParseBuilder(:class:`GIMIParser`)

    Default: None

  • iniFixBuilder (Optional[IniFixBuilder]) –

    The builder to build the fixer used for .ini files

    If this value is None, then by default this attribute will be set to IniFixBuilder(:class:`GIMIFixer`)

    Default: None

  • iniRemoveBuilder (Optional[IniRemoveBuilder]) –

    The builder to build the remover used for .ini files

    If this value is None, then by default this attribute will be set to IniRemoveBuilder(:class:`IniRemover`)

    Default: None

name

The default name for the type of mod

Type:

str

check

The specific check used to identify the .ini file belongs to the specific type of mod when checking arbitrary line in a .ini file

Type:

Union[str, Pattern, Callable[[str], bool]]

hashes

The hashes related to the mod and its fix

Type:

Hashes

indices

The indices related to the mod and its fix

Type:

Indices

vgRemaps

The repository that stores the mapping for remapping vertex group blend indices of the mod to the vertex group blend indices of another mod

Type:

VGRemaps

aliases

Other alternative names for the type of mod

Type:

Optional[List[str]]

iniParseBuilder

The builder to build the parser used for .ini files

Type:

IniParseBuilder

iniFixBuilder

the builder to build the fixer used for .ini files

Type:

IniFixBuilder

iniRemoveBuilder

the builder to build the remover used for .ini files

Type:

IniRemoveBuilder

fixIni(iniFile: IniFile, keepBackup: bool = True, fixOnly: bool = False)

Fixes the .ini file associated to this type of mod

Parameters:
  • iniFile (IniFile) – The .ini file to fix

  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

getModsToFix() Set[str]

Retrieves the names of the mods this mod type will fix to

Returns:

The names of the mods to fix to

Return type:

Set[str]

getVGRemap(modName: str, version: float | None = None) VGRemap

Retrieves the corresponding Vertex Group Remap

Attention

This function assumes that the specified map ModType.vgRemaps (VGRemaps.map) contains ModType.name (the name of this mod type) as a mod to map from

Parameters:
  • modName (str) – The name of the mod to map to

  • version (Optional[float]) –

    The specific game version we want for the remap

    If this value is None, then will get the latest version of the remap

    Default: None

Returns:

The corresponding remap

Return type:

VGRemap

isName(name: str) bool

Determines whether a certain name matches with the names defined for this type of mod

Parameters:

name (str) – The name being searched

Returns:

Whether the searched name matches with the names for this type of mod

Return type:

bool

isType(iniLine: str) bool

Determines whether a line in the .ini file correponds with this mod type

Parameters:

iniLine (str) – An arbitrary line in a .ini file

Returns:

Whether the line in the .ini file corresponds with this type of mod

Return type:

bool


ModTypeBuilder

class ModTypeBuilder

Class to create a new ModType for different mods


GIBuilder

class GIBuilder

This Class inherits from ModTypeBuilder

Creates new ModType objects for some anime game

classmethod amber() ModType

Creates the ModType for Amber

Returns:

The resultant ModType

Return type:

ModType

classmethod amberCN() ModType

Creates the ModType for AmberCN

Returns:

The resultant ModType

Return type:

ModType

classmethod arlecchino() ModType

Creates the ModType for Arlecchino

Returns:

The resultant ModType

Return type:

ModType

classmethod ayaka() ModType

Creates the ModType for Ayaka

Returns:

The resultant ModType

Return type:

ModType

classmethod ayakaSpringBloom() ModType

Creates the ModType for AyakaSpringBloom

Returns:

The resultant ModType

Return type:

ModType

classmethod barbara() ModType

Creates the ModType for Barbara

Returns:

The resultant ModType

Return type:

ModType

classmethod barbaraSummerTime() ModType

Creates the ModType for BarbaraSummerTime

Returns:

The resultant ModType

Return type:

ModType

classmethod diluc() ModType

Creates the ModType for Diluc

Returns:

The resultant ModType

Return type:

ModType

classmethod dilucFlamme() ModType

Creates the ModType for DilucFlamme

Returns:

The resultant ModType

Return type:

ModType

classmethod fischl() ModType

Creates the ModType for Fischl

Returns:

The resultant ModType

Return type:

ModType

classmethod fischlHighness() ModType

Creates the ModType for FischlHighness

Returns:

The resultant ModType

Return type:

ModType

classmethod ganyu() ModType

Creates the ModType for Ganyu

Returns:

The resultant ModType

Return type:

ModType

classmethod ganyuTwilight() ModType

Creates the ModType for GanyuTwilight

Returns:

The resultant ModType

Return type:

ModType

classmethod jean() ModType

Creates the ModType for Jean

Returns:

The resultant ModType

Return type:

ModType

classmethod jeanCN() ModType

Creates the ModType for JeanCN

Returns:

The resultant ModType

Return type:

ModType

classmethod jeanSea() ModType

Creates the ModType for JeanSea

Returns:

The resultant ModType

Return type:

ModType

classmethod keqing() ModType

Creates the ModType for Keqing

Returns:

The resultant ModType

Return type:

ModType

classmethod keqingOpulent() ModType

Creates the ModType for KeqingOpulent

Returns:

The resultant ModType

Return type:

ModType

classmethod kirara() ModType

Creates the ModType for Kirara

Returns:

The resultant ModType

Return type:

ModType

classmethod kiraraBoots() ModType

Creates the ModType for KiraraBoots

Returns:

The resultant ModType

Return type:

ModType

classmethod klee() ModType

Creates the ModType for Klee

Returns:

The resultant ModType

Return type:

ModType

classmethod kleeBlossomingStarlight() ModType

Creates the ModType for KleeBlossomingStarlight

Returns:

The resultant ModType

Return type:

ModType

classmethod mona() ModType

Creates the ModType for Mona

Returns:

The resultant ModType

Return type:

ModType

classmethod monaCN() ModType

Creates the ModType for MonaCN

Returns:

The resultant ModType

Return type:

ModType

classmethod nilou() ModType

Creates the ModType for Nilou

Returns:

The resultant ModType

Return type:

ModType

classmethod nilouBreeze() ModType

Creates the ModType for NilouBreeze

Returns:

The resultant ModType

Return type:

ModType

classmethod ningguang() ModType

Creates the ModType for Ningguang

Returns:

The resultant ModType

Return type:

ModType

classmethod ningguangOrchid() ModType

Creates the ModType for Ningguang

Returns:

The resultant ModType

Return type:

ModType

classmethod raiden() ModType

Creates the ModType for Ei

Returns:

The resultant ModType

Return type:

ModType

classmethod rosaria() ModType

Creates the ModType for Rosaria

Returns:

The resultant ModType

Return type:

ModType

classmethod rosariaCN() ModType

Creates the ModType for RosariaCN

Returns:

The resultant ModType

Return type:

ModType

classmethod shenhe() ModType

Creates the ModType for Shenhe

Returns:

The resultant ModType

Return type:

ModType

classmethod shenheFrostFlower() ModType

Creates the ModType for ShenheFrostFlower

Returns:

The resultant ModType

Return type:

ModType


ModAssets

class ModAssets(repo: Dict[float, Dict[str, T]], map: Dict[str, Set[str]] | None = None)

Class to handle assets of any type for a mod

Note

This is a bipartite graph that maps assets to fix from to assets to fix to

Parameters:
  • repo (Dict[str, Dict[str, T]]) –

    The original source for any preset assets

    • The outer key is the game version number for the assets

    • The inner key is the name of the asset

    • The inner value is the content for the asset

  • map (Optional[Dict[str, Set[str]]]) –

    The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods

    Default: None

repo

The original source for any preset assets

  • The outer key is the game version number for the assets

  • The inner key is the name of the asset

  • The inner value is the content for the asset

Type:

Dict[float, Dict[str, T]]

_addVersion(name: str, version: float)

Adds a new version for a particular asset

Parameters:
  • name (str) – The name of the asset

  • version (float) – The game version

_partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
  • Creates the bipartition for the assets to fix from vs the assets to fix to

  • Filters the mapping such that all the asset names in the new mapping exist in assets

Parameters:
  • map (Dict[str, Set[str]]) – The desired mapping for the assets for fixing

  • assets (Dict[float, Dict[str, Any]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The following output is in the same order as listed below:

  1. The new mapping with all asset names being in assets

  2. The names of the assets to fix from

  3. The names of the assets to fix to

Return type:

Tuple[Dict[str, Set[str]], Set[str], Set[str]]

_updateAssetContent(srcAsset: T, newAsset: T) T

Combines the content of 2 assets

Parameters:
  • srcAsset (T) – The content of the asset to be updates

  • newAsset (T) – The new asset to update into srcAsset

Returns:

The updated asset

Return type:

T

_updateVersions(assets: Dict[float, Dict[str, T]])

Updates the versioning of the assets

Parameters:

assets (T) – The assets for checking the versioning

addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, T]] | None = None)

Adds a new map to the existing map on how to retrieve the assets

Parameters:
  • assetMap (Dict[str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix to

  • assets (Optional[T]) –

    Any new assets that needs to be added/updated to the existing assets to support the given map

    Default: None

addMapping(fromAsset: str, toAssets: Set[str], assets: Any)

Adds a new mapping of how to fix the assets

Parameters:
  • fromAsset (str) – The name of the asset to fix from

  • toAssets (Set[str]) – The names of the assets to fix to

  • assets (Any) – Any new assets that needs to be added/updated to the existing assets to support the new mapping

clear(flush: bool = True, clearMap: bool = False)

Clears all the assets

Parameters:
  • flush (bool) –

    Whether to flush out (reload) any cached data

    Default: False

  • clearMap (bool) –

    Whether to clear out the mapping for the assets

    Default: False

findClosestVersion(name: str, version: float | None = None, fromCache: bool = True) float

Finds the closest available game version from ModStrAssets._toAssets for a particular asset

Parameters:
  • name (str) – The name of the asset to search

  • version (Optional[float]) –

    The game version to be searched

    If This value is None, then will assume we want the latest version

    Default: None

  • fromCache (bool) –

    Whether to use the result from the cache

    Default: None

Raises:

KeyError – The name for the particular asset is not found

Returns:

The latest game version from the assets that corresponds to the desired version

Return type:

float

property fixFrom: Set[str]

The names of the assets to fix from using the predefined mods

Getter:

Retrieves the names of assets used to fix from

Type:

Set[str]

property fixTo: Set[str]

The names of the assets to fix to using the predefined mods

Getter:

Retrives the names of assets to fix to

Type:

Set[str]

loadFromPreset()

Reinitializes to load the predefined mods

property map: Dict[str, Set[str]]

The adjacency list used to map assets to fix from to assets to fix to

Getter:

Retrieves the adjacency list

Setter:

Sets a new adjacency list

Type:

Dict[str, Set[str]]

classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]

Combines 2 maps together

Parameters:
  • srcMap (Dict[str, Set[str]]) – The map to be updates

  • newMap (Dict[str, Set[str]]) – The new map to update srcMap

Returns:

The updated map

Return type:

Dict[str, Set[str]]

updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]

Updates the values in srcRepo

Parameters:
  • srcRepo (Dict[float, Dict[str, Any]]) – The first repo to be combined

  • newRepo (Dict[float, Dict[str, Any]]) – The second repo to be combined

Returns:

The combined repo

Return type:

Dict[float, Dict[str, Any]]

property versions: Dict[str, Version]

The game versions available for the assets

  • The keys are the names of the assets

  • The values are versions for the asset

Getter:

Returns all the available game versions for the assets

Type:

Dict[str, Version]


ModIdAssets

class ModIdAssets(repo: Dict[float, Dict[str, Dict[str, str]]], map: Dict[str, Set[str]] | None = None)

This class inherits from ModAssets

Class to handle hashes, indices, and other string id type assets for a mod

Parameters:
  • repo (Dict[float, Dict[str, Dict[str, str]]]) –

    The original source for any preset assets

    • The outer key is the game version of the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset

    Note

    The id value for each asset should be unique

  • map (Optional[Dict[str, Set[str]]]) –

    The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods

    Default: None

_addVersion(name: str, version: float)

Adds a new version for a particular asset

Parameters:
  • name (str) – The name of the asset

  • version (float) – The game version

classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]

Retrieves the assets to fix from

Parameters:
  • map (Dict[str, Set[str]]) – The mapping for fixing the assets

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Return type:

Dict[str, Tuple[Set[str], str]]

_getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]

Retrieves the assets to fix to

Parameters:
  • assetNames (Set[str]) – The names of the assets to fix to

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix to

  • The outer key is the game version number for the assets

  • The first inner key is the name of the asset

  • The second inner key is the type of asset

  • The most inner value is the id for the asset (must be unique)

Return type:

Dict[float, Dict[str, Dict[str, str]]]

_partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
  • Creates the bipartition for the assets to fix from vs the assets to fix to

  • Filters the mapping such that all the asset names in the new mapping exist in assets

Parameters:
  • map (Dict[str, Set[str]]) – The desired mapping for the assets for fixing

  • assets (Dict[float, Dict[str, Any]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The following output is in the same order as listed below:

  1. The new mapping with all asset names being in assets

  2. The names of the assets to fix from

  3. The names of the assets to fix to

Return type:

Tuple[Dict[str, Set[str]], Set[str], Set[str]]

_updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]

Combines the content of 2 assets

Parameters:
  • srcAsset (T) – The content of the asset to be updates

  • newAsset (T) – The new asset to update into srcAsset

Returns:

The updated asset

Return type:

T

_updateVersions(assets: Dict[float, Dict[str, T]])

Updates the versioning of the assets

Parameters:

assets (T) – The assets for checking the versioning

addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)

Adds a new map to the existing map on how to retrieve the assets

Parameters:
  • assetMap (Dict[str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix to

  • assets (Optional[T]) –

    Any new assets that needs to be added/updated to the existing assets to support the given map

    Default: None

addMapping(fromAsset: str, toAssets: Set[str], assets: Any)

Adds a new mapping of how to fix the assets

Parameters:
  • fromAsset (str) – The name of the asset to fix from

  • toAssets (Set[str]) – The names of the assets to fix to

  • assets (Any) – Any new assets that needs to be added/updated to the existing assets to support the new mapping

clear(flush: bool = True, clearMap: bool = False)

Clears all the assets

Parameters:
  • flush (bool) –

    Whether to flush out (reload) any cached data

    Default: False

  • clearMap (bool) –

    Whether to clear out the mapping for the assets

    Default: False

findClosestVersion(name: str, version: float | None = None, fromCache: bool = True) float

Finds the closest available game version from ModStrAssets._toAssets for a particular asset

Parameters:
  • name (str) – The name of the asset to search

  • version (Optional[float]) –

    The game version to be searched

    If This value is None, then will assume we want the latest version

    Default: None

  • fromCache (bool) –

    Whether to use the result from the cache

    Default: None

Raises:

KeyError – The name for the particular asset is not found

Returns:

The latest game version from the assets that corresponds to the desired version

Return type:

float

property fixFrom: Set[str]

The names of the assets to fix from using the predefined mods

Getter:

Retrieves the names of assets used to fix from

Type:

Set[str]

property fixTo: Set[str]

The names of the assets to fix to using the predefined mods

Getter:

Retrives the names of assets to fix to

Type:

Set[str]

property fromAssets: Dict[str, Tuple[Set[str], str]]

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Getter:

Returns the assets needed to be fixed

Type:

Dict[str, Tuple[Set[str], str]]

get(assetName: str, assetType: str, version: float | None = None) str

Retrieves the corresponding id asset from ModStrAssets._toAssets

Parameters:
  • assetName (str) – The name of the assets we want

  • assetType (str) – The name of the type of asset we want.

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

Raises:

KeyError – If the corresponding asset based on the search parameters is not found

Returns:

The found asset

Return type:

str

loadFromPreset()

Reinitializes to load the predefined mods

property map: Dict[str, Set[str]]

The adjacency list used to map assets to fix from to assets to fix to

Getter:

Retrieves the adjacency list

Setter:

Sets a new adjacency list

Type:

Dict[str, Set[str]]

replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]

Retrieves the corresponding asset to replace ‘fromAsset’

Parameters:
  • fromAsset (str) – The asset to be replaced

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

  • toAssets (Optional[Union[str, Set[str]]]) – The assets to used for replacement

Returns:

The corresponding assets for the fix to replace, if available

The result is a string if the passed in parameter ‘toAssets’ is also a string

Otherwise, the result is a dictionary such that:

  • The keys are the names of the assets

  • The values are the corresponding asset ids to replace

Return type:

Union[str, Dict[str, str]]

property toAssets: Dict[float, Dict[str, Dict[str, str]]]



  • The outer key is the game version number for the assets

  • The first inner key is the name of the assets

  • The most inner key is the type of asset

  • The most inner value is the id for the asset

Getter:

Returns the new assets that will replace the old assets

Type:

Dict[float, Dict[str, Dict[str, str]]]

Type:

The assets to fix to

classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]

Combines 2 maps together

Parameters:
  • srcMap (Dict[str, Set[str]]) – The map to be updates

  • newMap (Dict[str, Set[str]]) – The new map to update srcMap

Returns:

The updated map

Return type:

Dict[str, Set[str]]

updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]

Updates the values in srcRepo

Parameters:
  • srcRepo (Dict[float, Dict[str, Any]]) – The first repo to be combined

  • newRepo (Dict[float, Dict[str, Any]]) – The second repo to be combined

Returns:

The combined repo

Return type:

Dict[float, Dict[str, Any]]

property versions: Dict[str, Version]

The game versions available for the assets

  • The keys are the names of the assets

  • The values are versions for the asset

Getter:

Returns all the available game versions for the assets

Type:

Dict[str, Version]


VGRemap

Attributes
class VGRemap(vgRemap: Dict[int, int])

Class for handling the vertex group remaps for mods

Parameters:

vgRemap (Dict[int, int]) – The vertex group remap from one type of mod to another

property maxIndex

The maximum index in the vertex group remap

Getter:

Retrieves the max index

Type:

int

property remap

The vertex group remap

Getter:

Retrieves the remap

Setter:

Sets a new remap

Type:

Dict[int, int]


VGRemaps

class VGRemaps(map: Dict[str, Set[str]] | None = None)

This class inherits from ModAssets

Class to handle Vertex Group Remaps fsor a mod

Parameters:

map (Optional[Dict[str, Set[str]]]) –

The adjacency list that maps the assets to fix from to the assets to fix to using the predefined mods

Default: None

_addVersion(fromAsset: str, toAsset: str, version: float)

Adds a new version for a particular asset

Parameters:
  • name (str) – The name of the asset

  • version (float) – The game version

_partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
  • Creates the bipartition for the assets to fix from vs the assets to fix to

  • Filters the mapping such that all the asset names in the new mapping exist in assets

Parameters:
  • map (Dict[str, Set[str]]) – The desired mapping for the assets for fixing

  • assets (Dict[float, Dict[str, Any]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The following output is in the same order as listed below:

  1. The new mapping with all asset names being in assets

  2. The names of the assets to fix from

  3. The names of the assets to fix to

Return type:

Tuple[Dict[str, Set[str]], Set[str], Set[str]]

_updateAssetContent(asset1: Dict[str, VGRemap], asset2: Dict[str, VGRemap]) T

Combines the content of 2 assets

Parameters:
  • srcAsset (T) – The content of the asset to be updates

  • newAsset (T) – The new asset to update into srcAsset

Returns:

The updated asset

Return type:

T

_updateVersions(assets: Dict[float, Dict[str, Dict[str, VGRemap]]])

Updates the versioning of the assets

Parameters:

assets (T) – The assets for checking the versioning

addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, T]] | None = None)

Adds a new map to the existing map on how to retrieve the assets

Parameters:
  • assetMap (Dict[str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix to

  • assets (Optional[T]) –

    Any new assets that needs to be added/updated to the existing assets to support the given map

    Default: None

addMapping(fromAsset: str, toAssets: Set[str], assets: Any)

Adds a new mapping of how to fix the assets

Parameters:
  • fromAsset (str) – The name of the asset to fix from

  • toAssets (Set[str]) – The names of the assets to fix to

  • assets (Any) – Any new assets that needs to be added/updated to the existing assets to support the new mapping

clear(flush: bool = True, clearMap: bool = False)

Clears all the assets

Parameters:
  • flush (bool) –

    Whether to flush out (reload) any cached data

    Default: False

  • clearMap (bool) –

    Whether to clear out the mapping for the assets

    Default: False

findClosestVersion(fromAsset: str, toAsset: str, version: float | None = None, fromCache: bool = True) float

Finds the closest available game version from ModStrAssets._toAssets for a particular asset

Parameters:
  • fromAsset (str) – The name of the asset to map from

  • toAsset (str) – The name of the asset to map to

  • version (Optional[float]) –

    The game version to be searched

    If This value is None, then will assume we want the latest version

    Default: None

  • fromCache (bool) –

    Whether to use the result from the cache

    Default: None

Raises:

KeyError – The name for the particular asset is not found

Returns:

The latest game version from the assets that corresponds to the desired version

Return type:

float

property fixFrom: Set[str]

The names of the assets to fix from using the predefined mods

Getter:

Retrieves the names of assets used to fix from

Type:

Set[str]

property fixTo: Set[str]

The names of the assets to fix to using the predefined mods

Getter:

Retrives the names of assets to fix to

Type:

Set[str]

get(fromAsset: str, toAsset: str, version: float | None = None) str

Retrieves the corresponding vertex group remap

Parameters:
  • fromAsset (str) – The name of the asset to map from

  • toAsset (str) – The name of the asset to map to

  • version (Optional[float]) –

    The game version we want the remap to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

Raises:

KeyError – If the corresponding asset based on the search parameters is not found

Returns:

The found asset

Return type:

str

loadFromPreset()

Reinitializes to load the predefined mods

property map: Dict[str, Set[str]]

The adjacency list used to map assets to fix from to assets to fix to

Getter:

Retrieves the adjacency list

Setter:

Sets a new adjacency list

Type:

Dict[str, Set[str]]

classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]

Combines 2 maps together

Parameters:
  • srcMap (Dict[str, Set[str]]) – The map to be updates

  • newMap (Dict[str, Set[str]]) – The new map to update srcMap

Returns:

The updated map

Return type:

Dict[str, Set[str]]

updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]

Updates the values in srcRepo

Parameters:
  • srcRepo (Dict[float, Dict[str, Any]]) – The first repo to be combined

  • newRepo (Dict[float, Dict[str, Any]]) – The second repo to be combined

Returns:

The combined repo

Return type:

Dict[float, Dict[str, Any]]

property versions: Dict[str, Version]

The game versions available for the assets

  • The outer keys are the names of the assets to map from

  • The inner keys are the names of the assets to map to

  • The inner values are versions for the assets

Getter:

Returns all the available game versions for the assets

Type:

Dict[str, Dict[str, Version]]


Hashes

class Hashes(map: Dict[str, Set[str]] | None = None)

This class inherits from ModDictStrAssets

Class for managing hashes for a mod

Parameters:

map (Optional[Dict[str, Set[str]]]) –

The adjacency list that maps the hashes to fix from to the hashes to fix to using the predefined mods

Default: None

_addVersion(name: str, version: float)

Adds a new version for a particular asset

Parameters:
  • name (str) – The name of the asset

  • version (float) – The game version

classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]

Retrieves the assets to fix from

Parameters:
  • map (Dict[str, Set[str]]) – The mapping for fixing the assets

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Return type:

Dict[str, Tuple[Set[str], str]]

_getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]

Retrieves the assets to fix to

Parameters:
  • assetNames (Set[str]) – The names of the assets to fix to

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix to

  • The outer key is the game version number for the assets

  • The first inner key is the name of the asset

  • The second inner key is the type of asset

  • The most inner value is the id for the asset (must be unique)

Return type:

Dict[float, Dict[str, Dict[str, str]]]

_partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
  • Creates the bipartition for the assets to fix from vs the assets to fix to

  • Filters the mapping such that all the asset names in the new mapping exist in assets

Parameters:
  • map (Dict[str, Set[str]]) – The desired mapping for the assets for fixing

  • assets (Dict[float, Dict[str, Any]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The following output is in the same order as listed below:

  1. The new mapping with all asset names being in assets

  2. The names of the assets to fix from

  3. The names of the assets to fix to

Return type:

Tuple[Dict[str, Set[str]], Set[str], Set[str]]

_updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]

Combines the content of 2 assets

Parameters:
  • srcAsset (T) – The content of the asset to be updates

  • newAsset (T) – The new asset to update into srcAsset

Returns:

The updated asset

Return type:

T

_updateVersions(assets: Dict[float, Dict[str, T]])

Updates the versioning of the assets

Parameters:

assets (T) – The assets for checking the versioning

addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)

Adds a new map to the existing map on how to retrieve the assets

Parameters:
  • assetMap (Dict[str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix to

  • assets (Optional[T]) –

    Any new assets that needs to be added/updated to the existing assets to support the given map

    Default: None

addMapping(fromAsset: str, toAssets: Set[str], assets: Any)

Adds a new mapping of how to fix the assets

Parameters:
  • fromAsset (str) – The name of the asset to fix from

  • toAssets (Set[str]) – The names of the assets to fix to

  • assets (Any) – Any new assets that needs to be added/updated to the existing assets to support the new mapping

clear(flush: bool = True, clearMap: bool = False)

Clears all the assets

Parameters:
  • flush (bool) –

    Whether to flush out (reload) any cached data

    Default: False

  • clearMap (bool) –

    Whether to clear out the mapping for the assets

    Default: False

findClosestVersion(name: str, version: float | None = None, fromCache: bool = True) float

Finds the closest available game version from ModStrAssets._toAssets for a particular asset

Parameters:
  • name (str) – The name of the asset to search

  • version (Optional[float]) –

    The game version to be searched

    If This value is None, then will assume we want the latest version

    Default: None

  • fromCache (bool) –

    Whether to use the result from the cache

    Default: None

Raises:

KeyError – The name for the particular asset is not found

Returns:

The latest game version from the assets that corresponds to the desired version

Return type:

float

property fixFrom: Set[str]

The names of the assets to fix from using the predefined mods

Getter:

Retrieves the names of assets used to fix from

Type:

Set[str]

property fixTo: Set[str]

The names of the assets to fix to using the predefined mods

Getter:

Retrives the names of assets to fix to

Type:

Set[str]

property fromAssets: Dict[str, Tuple[Set[str], str]]

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Getter:

Returns the assets needed to be fixed

Type:

Dict[str, Tuple[Set[str], str]]

get(assetName: str, assetType: str, version: float | None = None) str

Retrieves the corresponding id asset from ModStrAssets._toAssets

Parameters:
  • assetName (str) – The name of the assets we want

  • assetType (str) – The name of the type of asset we want.

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

Raises:

KeyError – If the corresponding asset based on the search parameters is not found

Returns:

The found asset

Return type:

str

loadFromPreset()

Reinitializes to load the predefined mods

property map: Dict[str, Set[str]]

The adjacency list used to map assets to fix from to assets to fix to

Getter:

Retrieves the adjacency list

Setter:

Sets a new adjacency list

Type:

Dict[str, Set[str]]

replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]

Retrieves the corresponding asset to replace ‘fromAsset’

Parameters:
  • fromAsset (str) – The asset to be replaced

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

  • toAssets (Optional[Union[str, Set[str]]]) – The assets to used for replacement

Returns:

The corresponding assets for the fix to replace, if available

The result is a string if the passed in parameter ‘toAssets’ is also a string

Otherwise, the result is a dictionary such that:

  • The keys are the names of the assets

  • The values are the corresponding asset ids to replace

Return type:

Union[str, Dict[str, str]]

property toAssets: Dict[float, Dict[str, Dict[str, str]]]



  • The outer key is the game version number for the assets

  • The first inner key is the name of the assets

  • The most inner key is the type of asset

  • The most inner value is the id for the asset

Getter:

Returns the new assets that will replace the old assets

Type:

Dict[float, Dict[str, Dict[str, str]]]

Type:

The assets to fix to

classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]

Combines 2 maps together

Parameters:
  • srcMap (Dict[str, Set[str]]) – The map to be updates

  • newMap (Dict[str, Set[str]]) – The new map to update srcMap

Returns:

The updated map

Return type:

Dict[str, Set[str]]

updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]

Updates the values in srcRepo

Parameters:
  • srcRepo (Dict[float, Dict[str, Any]]) – The first repo to be combined

  • newRepo (Dict[float, Dict[str, Any]]) – The second repo to be combined

Returns:

The combined repo

Return type:

Dict[float, Dict[str, Any]]

property versions: Dict[str, Version]

The game versions available for the assets

  • The keys are the names of the assets

  • The values are versions for the asset

Getter:

Returns all the available game versions for the assets

Type:

Dict[str, Version]


Indices

class Indices(map: Dict[str, Set[str]] | None = None)

This class inherits from ModDictStrAssets

Class for managing indices for a mod

Parameters:

map (Optional[Dict[str, Set[str]]]) –

The adjacency list that maps the indices to fix from to the indices to fix to using the predefined mods

Default: None

_addVersion(name: str, version: float)

Adds a new version for a particular asset

Parameters:
  • name (str) – The name of the asset

  • version (float) – The game version

classmethod _getFromAssets(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[str, Tuple[Set[str], str]]

Retrieves the assets to fix from

Parameters:
  • map (Dict[str, Set[str]]) – The mapping for fixing the assets

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Return type:

Dict[str, Tuple[Set[str], str]]

_getToAssets(assetNames: Set[str], assets: Dict[float, Dict[str, Dict[str, str]]]) Dict[float, Dict[str, Dict[str, str]]]

Retrieves the assets to fix to

Parameters:
  • assetNames (Set[str]) – The names of the assets to fix to

  • assets (Dict[float, Dict[str, Dict[str, str]]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The assets to fix to

  • The outer key is the game version number for the assets

  • The first inner key is the name of the asset

  • The second inner key is the type of asset

  • The most inner value is the id for the asset (must be unique)

Return type:

Dict[float, Dict[str, Dict[str, str]]]

_partition(map: Dict[str, Set[str]], assets: Dict[float, Dict[str, Any]]) Tuple[Dict[str, Set[str]], Set[str], Set[str]]
  • Creates the bipartition for the assets to fix from vs the assets to fix to

  • Filters the mapping such that all the asset names in the new mapping exist in assets

Parameters:
  • map (Dict[str, Set[str]]) – The desired mapping for the assets for fixing

  • assets (Dict[float, Dict[str, Any]]) –

    The source for all the assets

    • The outer key is the game version number for the assets

    • The first inner key is the name of the asset

    • The second inner key is the type of asset

    • The most inner value is the id for the asset (must be unique)

Returns:

The following output is in the same order as listed below:

  1. The new mapping with all asset names being in assets

  2. The names of the assets to fix from

  3. The names of the assets to fix to

Return type:

Tuple[Dict[str, Set[str]], Set[str], Set[str]]

_updateAssetContent(srcAsset: Dict[str, str], newAsset: Dict[str, str]) Dict[str, str]

Combines the content of 2 assets

Parameters:
  • srcAsset (T) – The content of the asset to be updates

  • newAsset (T) – The new asset to update into srcAsset

Returns:

The updated asset

Return type:

T

_updateVersions(assets: Dict[float, Dict[str, T]])

Updates the versioning of the assets

Parameters:

assets (T) – The assets for checking the versioning

addMap(assetMap: Dict[str, Set[str]], assets: Dict[float, Dict[str, Dict[str, str]]] | None = None)

Adds a new map to the existing map on how to retrieve the assets

Parameters:
  • assetMap (Dict[str, Set[str]]) – The new adjacency list used to map assets to fix from to assets to fix to

  • assets (Optional[T]) –

    Any new assets that needs to be added/updated to the existing assets to support the given map

    Default: None

addMapping(fromAsset: str, toAssets: Set[str], assets: Any)

Adds a new mapping of how to fix the assets

Parameters:
  • fromAsset (str) – The name of the asset to fix from

  • toAssets (Set[str]) – The names of the assets to fix to

  • assets (Any) – Any new assets that needs to be added/updated to the existing assets to support the new mapping

clear(flush: bool = True, clearMap: bool = False)

Clears all the assets

Parameters:
  • flush (bool) –

    Whether to flush out (reload) any cached data

    Default: False

  • clearMap (bool) –

    Whether to clear out the mapping for the assets

    Default: False

findClosestVersion(name: str, version: float | None = None, fromCache: bool = True) float

Finds the closest available game version from ModStrAssets._toAssets for a particular asset

Parameters:
  • name (str) – The name of the asset to search

  • version (Optional[float]) –

    The game version to be searched

    If This value is None, then will assume we want the latest version

    Default: None

  • fromCache (bool) –

    Whether to use the result from the cache

    Default: None

Raises:

KeyError – The name for the particular asset is not found

Returns:

The latest game version from the assets that corresponds to the desired version

Return type:

float

property fixFrom: Set[str]

The names of the assets to fix from using the predefined mods

Getter:

Retrieves the names of assets used to fix from

Type:

Set[str]

property fixTo: Set[str]

The names of the assets to fix to using the predefined mods

Getter:

Retrives the names of assets to fix to

Type:

Set[str]

property fromAssets: Dict[str, Tuple[Set[str], str]]

The assets to fix from

  • The keys are the ids for the asset

  • The values contains metadata about the assets to fix to where each tuple contains:

    # The names of the assets # The type of asset

Getter:

Returns the assets needed to be fixed

Type:

Dict[str, Tuple[Set[str], str]]

get(assetName: str, assetType: str, version: float | None = None) str

Retrieves the corresponding id asset from ModStrAssets._toAssets

Parameters:
  • assetName (str) – The name of the assets we want

  • assetType (str) – The name of the type of asset we want.

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

Raises:

KeyError – If the corresponding asset based on the search parameters is not found

Returns:

The found asset

Return type:

str

loadFromPreset()

Reinitializes to load the predefined mods

property map: Dict[str, Set[str]]

The adjacency list used to map assets to fix from to assets to fix to

Getter:

Retrieves the adjacency list

Setter:

Sets a new adjacency list

Type:

Dict[str, Set[str]]

replace(fromAsset: str, version: float | None = None, toAssets: str | Set[str] | None = None) str | None | Dict[str, str]

Retrieves the corresponding asset to replace ‘fromAsset’

Parameters:
  • fromAsset (str) – The asset to be replaced

  • version (Optional[float]) –

    The game version we want the asset to come from

    If This value is None, then will retrieve the asset of the latest version.

    Default: None

  • toAssets (Optional[Union[str, Set[str]]]) – The assets to used for replacement

Returns:

The corresponding assets for the fix to replace, if available

The result is a string if the passed in parameter ‘toAssets’ is also a string

Otherwise, the result is a dictionary such that:

  • The keys are the names of the assets

  • The values are the corresponding asset ids to replace

Return type:

Union[str, Dict[str, str]]

property toAssets: Dict[float, Dict[str, Dict[str, str]]]



  • The outer key is the game version number for the assets

  • The first inner key is the name of the assets

  • The most inner key is the type of asset

  • The most inner value is the id for the asset

Getter:

Returns the new assets that will replace the old assets

Type:

Dict[float, Dict[str, Dict[str, str]]]

Type:

The assets to fix to

classmethod updateMap(srcMap: Dict[str, Set[str]], newMap: Dict[str, Set[str]]) Dict[str, Set[str]]

Combines 2 maps together

Parameters:
  • srcMap (Dict[str, Set[str]]) – The map to be updates

  • newMap (Dict[str, Set[str]]) – The new map to update srcMap

Returns:

The updated map

Return type:

Dict[str, Set[str]]

updateRepo(srcRepo: Dict[float, Dict[str, Any]], newRepo: Dict[float, Dict[str, Any]]) Dict[float, Dict[str, Any]]

Updates the values in srcRepo

Parameters:
  • srcRepo (Dict[float, Dict[str, Any]]) – The first repo to be combined

  • newRepo (Dict[float, Dict[str, Any]]) – The second repo to be combined

Returns:

The combined repo

Return type:

Dict[float, Dict[str, Any]]

property versions: Dict[str, Version]

The game versions available for the assets

  • The keys are the names of the assets

  • The values are versions for the asset

Getter:

Returns all the available game versions for the assets

Type:

Dict[str, Version]



Mod Files

Entities for representing some common used files in mods.


File

Methods
class File(logger: Logger | None = None)

Base class for a file

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any

read() Any

Reads the data within a file


IniFile

class IniFile(file: str | None = None, logger: Logger | None = None, txt: str = '', modTypes: Set[ModType] | None = None, defaultModType: ModType | None = None, version: float | None = None, modsToFix: Set[str] | None = None)

This class inherits from File

Class for handling .ini files


Note

We analyse the .ini file using Regex which is NOT the right way to do things since the modified .ini language that GIMI interprets is a CFG (context free grammer) and NOT a regular language.

But since we are lazy and don’t want make our own compiler with tokenizers, parsing algorithms (eg. SLR(1)), type checking, etc… this module should handle regular cases of .ini files generated using existing scripts (assuming the user does not do anything funny…)


Parameters:
  • file (Optional[str]) –

    The file path to the .ini file

    Default: None

  • logger (Optional[Logger]) – The logger to print messages if necessary

  • txt (str) –

    Used as the text content of the .ini file if IniFile.file is set to None

    Default: “”

  • modTypes (Optional[Set[ModType]]) –

    The types of mods that the .ini file should belong to

    Default: None

  • modsToFix (Optional[Set[str]]) –

    The names of the mods we want to fix to

    Default: None

  • defaultModType (Optional[ModType]) –

    The type of mod to use if the .ini file has an unidentified mod type

    If this value is None, then will skip the .ini file with an unidentified mod type

    Default: None

  • version (Optional[float]) –

    The game version we want the .ini file to be compatible with

    If This value is None, then will retrieve the hashes/indices of the latest version.

    Default: None

version

The game version we want the .ini file to be compatible with

If This value is None, then will retrieve the hashes/indices of the latest version.

Type:

Optional[float]

_parser

Parser used to parse very basic cases in a .ini file

Type:

ConfigParser

modTypes

The types of mods that the .ini file should belong to

Type:

Set[ModType]

modsToFix

The names of the mods that we want to fix to

Type:

Set[str]

defaultModType

The type of mod to use if the .ini file has an unidentified mod type

Type:

Optional[ModType]

_textureOverrideBlendRoot

The name for the section containing the keywords: [.*TextureOverride.*Blend.*]

Type:

Optional[str]

sectionIfTemplates

All the sections in the .ini file that can be parsed into an IfTemplate

For more info see IfTemplate

Attention

The modified .ini language that GIMI uses introduces keywords that can be used before the key of a key-value pair

eg. defining constants

1[Constants]
2global persist $swapvar = 0
3global persist $swapscarf = 0
4global $active
5global $creditinfo = 0


Sections containing this type of pattern will not be parsed. But generally, these sections are irrelevant to fixing the Raiden Boss

Type:

Dict[str, IfTemplate]

_resourceBlends

Sections that are linked to 1 or more Blend.buf files.

The keys are the name of the sections.

Type:

Dict[str, IfTemplate]

remapBlendModels

The data for the [Resource.*RemapBlend.*] sections used in the fix

The keys are the original names of the resource with the pattern [Resource.*Blend.*]

Type:

Dict[str, IniResourceModel]

texEditModels

The data for the [Resource.*] sections that belong to some texture file that got editted

  • The outer keys are the names for the type of texture files eg. MyBrandNewLightMap

  • The inner keys are the original names of the resource with the pattern [Resource.*]

Type:

Dict[str, Dict[str, IniTexModel]]

texAddModels

The data for the [Resource.*] sections that belong to some texture file that got added

  • The outer keys are the names for the type of texture files eg. MyBrandNewLightMap

  • The inner keys are the names of the mod object eg. Head

Type:

Dict[str, Dict[str, IniTexModel]]

_checkFixed(line: str)

Checks if a line of text matches the regex, [.*TextureOverride.*RemapBlend.*] ,to identify whether the .ini file has been fixed

Parameters:

line (str) – The line of text to check

_checkModType(line: str)

Checks if a line of text contains the keywords to identify whether the .ini file belongs to the types of mods in IniFile.modTypes

  • If IniFile.modTypes is not empty, then will find the first ModType that where the line makes ModType.isType() return True

  • Otherwise, will see if the line matches with the regex, [.*TextureOverride.*Blend.*]

Parameters:

line (str) – The text to check

_getCommandIfTemplate(sectionName: str, raiseException: bool = True) IfTemplate | None

Retrieves the IfTemplate for a certain section from IniFile._sectionIfTemplate

Parameters:
  • sectionName (str) – The name of the section

  • raiseException (bool) – Whether to raise an exception when the section’s IfTemplate is not found

Raises:

KeyError – If the IfTemplate for the section is not found and raiseException is set to True

Returns:

The corresponding IfTemplate for the section

Return type:

Optional[IfTemplate]

_getCommands(sectionName: str, subCommands: Set[str], subCommandLst: List[str])

Low level function for retrieving all the commands/sections that are called from a certain section in the .ini file

Parameters:
  • sectionName (str) – The name of the section we are starting from

  • subCommands (Set[str]) – The result for all of the sections that were called

  • subCommandLst (List[str]) – The result for all of the sections that were called while maintaining the order the sections are called in the call stack

Raises:

KeyError – If the IfTemplate is not found for some section

_getFixer()

Retrieves the fixer for fixing the .ini file

Returns:

The resultant fixer

Return type:

Optional[BaseIniFixer]

_getIfTemplateResourceName(ifTemplatePart: Dict[str, Any]) Any

Retrieves the value from the key, ‘vb1’, for some part of a section

Parameters:

ifTemplatePart (Dict[str, Any]) – The key-value pairs for some part in a section

Returns:

The corresponding value for the key ‘vb1’

Return type:

Any

_getParser() BaseIniParser | None

Retrieves the parser for parsing the .ini file

Returns:

The resultant parser

Return type:

Optional[BaseIniParser]

_getRemover() BaseIniRemover

Retrieves the remover for removing fixes from the .ini file

Returns:

The resultant parser

Return type:

BaseIniRemover

_isIfTemplateDraw(ifTemplatePart: Dict[str, Any]) bool

Whether the content for some part of a section contains the key ‘draw’

Parameters:

ifTemplatePart (Dict[str, Any]) – The key-value pairs for some part in a section

Returns:

Whether ‘draw’ is contained in the part

Return type:

bool

_isIfTemplateResource(ifTemplatePart: Dict[str, Any]) bool

Whether the content for some part of a section contains the key ‘vb1’

Parameters:

ifTemplatePart (Dict[str, Any]) – The key-value pairs for some part in a section

Returns:

Whether ‘vb1’ is contained in the part

Return type:

bool

_parseSection(sectionName: str, srcTxt: str, save: Dict[str, Any] | None = None) Dict[str, str] | None

Regularly parses the key-value pairs of a certain section

The function parses uses ConfigParser to parse the section.

Parameters:
  • sectionName (str) – The name of the section

  • srcTxt (str) – The text containing the entire section

  • save (Optional[Dict[str, Any]]) –

    Place to save the parsed result for the section

    The result for the parsed section will be saved as a value in the dictionary while section’s name will be used in the key for the dictionary

    Default: None

Returns:

The result from parsing the section

Note

If ConfigParser is unable to parse the section, then None is returned

Return type:

Optional[Dict[str, str]]

_processIfTemplate(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) IfTemplate

Parses a section in the .ini file as an IfTemplate

Note

See IfTemplate to see how we define an ‘IfTemplate’

Parameters:
  • startInd (int) – The starting line index of the section

  • endInd (int) – The ending line index of the section

  • fileLines (List[str]) – All the file lines read from the .ini file

  • sectionName (str) – The name of the section

  • srcTxt (str) – The text content of the section

Returns:

The generated IfTemplate from the section

Return type:

IfTemplate

_readLines()

Decorator to read all the lines in the .ini file first before running a certain function

All the file lines will be saved in IniFile._fileLines

Examples

1@_readLines
2def printLines(self):
3    for line in self._fileLines:
4        print(f"LINE: {line}")
_removeFix(parse: bool = False) str

Removes any previous changes that were probably made by this script

For the .ini file will remove:

  1. All code surrounded by the ‘—…— . Fix —…—-’* header/footer

  2. All sections containing the keywords RemapBlend

Parameters:

parse (bool) –

Whether to keep track of the Blend.buf files that also need to be removed

Default: False

Returns:

The new text content of the .ini file with the changes removed

Return type:

str

_removeSection(startInd: int, endInd: int, fileLines: List[str], sectionName: str, srcTxt: str) Tuple[int, int]

Retrieves the starting line index and ending line index of where to remove a certain section from the read lines of the .ini file

Parameters:
  • startInd (int) – The starting line index of the section

  • endInd (int) – The ending line index of the section

  • fileLines (List[str]) – All the file lines read from the .ini file

  • sectionName (str) – The name of the section

  • srcTxt (str) – The text content of the section

Returns:

The starting line index and the ending line index of the section to remove

Return type:

Tuple[int, int]

_setToFix() Set[str]

Sets the names for the types of mods that will used in the fix

Returns:

The names of the mods that will be used in the fix

Return type:

Set[str]

addFixBoilerPlate(fix: str = '') str

Adds the boilerplate code to identify the .ini sections have been changed by this fix

Parameters:

fix (str) –

The content for the fix

Default: ""

Returns:

The fix with the boilerplate code included

Return type:

str

property availableType: ModType | None

Retrieves the type of mod identified for this .ini file

Note

This function is the same as IniFile.type(), but will return IniFile.defaultModType if IniFile.type() is None

Returns:

The type of mod identified

Return type:

Optional[ModType]

checkIsMod() bool

Reads the entire .ini file and checks whether the .ini file belongs to a mod

Note

If the .ini file has already been parsed (eg. calling IniFile.checkModType() or IniFile.parse()), then

you only need to read IniFile.isModIni()

Returns:

Whether the .ini file is a .ini file that belongs to some mod

Return type:

bool

clear(eraseSourceTxt: bool = False)

Clears all the saved data for the .ini file

Note

Please see the note at IniFile.clearRead()

Parameters:

eraseSourceTxt (bool) –

Whether to erase the only data source for this class if IniFile.file is set to None, see the note at IniFile.clearRead() for more info

Default: False

clearRead(eraseSourceTxt: bool = False)

Clears the saved text read in from the .ini file

Note

If IniFile.file is set to None, then the default run of this function with the argument eraseSourceTxt set to False will have no effect since the provided text from IniFile._fileTxt is the only source of data for the IniFile

If you also want to clear the above source text data, then run this function with the eraseSourceTxt argument set to True

Parameters:

eraseSourceTxt (bool) –

Whether to erase the only data source for this class if IniFile.file is set to None, see the note above for more info

Default: False

classmethod compareResources(resourceTuple1: Tuple[str, int | None], resourceTuple2: Tuple[str, int | None]) int

Compare function used for sorting resources

The order for sorting is the resources is:

  1. Resources that do are not suffixed by an index number

  2. Resource that are suffixed by an index number (see IniFile.getMergedResourceIndex() for more info)

Parameters:
  • resourceTuple1 (Tuple[str, Optional[int]]) –

    Data for the first resource in the compare function, contains:

    • Name of the resource

    • The index for the resource

  • resourceTuple2 (Tuple[str, Optional[int]]) –

    Data for the second resource in the compare function, contains:

    • Name of the resource

    • The index for the resource

Returns:

The result for a typical compare function used in sorting

  • returns -1 if resourceTuple1 should come before resourceTuple2

  • returns 1 if resourceTuple1 should come after resourceTuple2

  • returns 0 if resourceTuple1 is equal to resourceTuple2

Return type:

int

disIni(makeCopy: bool = False)

Disables the .ini file

Note

For more info, see FileService.disableFile()

Parameters:

makeCopy (bool) –

Whether to make a copy of the disabled .ini file

Default: False

property file: str | None

The file path to the .ini file

Getter:

Returns the path to the file

Setter:

Sets the new path for the file

Type:

Optional[str]

property fileLines: List[str]

The text lines of the .ini file

Note

For the setter, each line must end with a newline character (same behaviour as readLines)

Getter:

Returns the text lines of the .ini file

Setter:

Reads the new value for both the text lines of the .ini file and the text content of the .ini file

Type:

List[str]

property fileLinesRead: bool

Whether the .ini file has been read

Getter:

Determines whether the .ini file has been read

Type:

bool

property filePath: FilePath | None

The path to the .ini file

Getter:

Returns the path to the file

Type:

Optional[FilePath]

property fileTxt: str

The text content of the .ini file

Getter:

Returns the content of the .ini file

Setter:

Reads the new value for both the text content of the .ini file and the text lines of the .ini file

Type:

str

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, str | Dict[str, Any], int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, Union[str, Dict[str, Any], int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether we want to make a backup copy of the .ini file

    Default: True

  • fixOnly (bool) –

    Whether we are only fixing the .ini file without removing any previous changes

    Default: False

  • update (bool) –

    Whether to also update the source text of this classs with the fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixBoilerPlate()

Decorator used to add the boilerplate code to identify a code section has been changed by this fix in the .ini file

Examples

1@fixBoilerPlate
2def helloWorld(self) -> str:
3    return "Hello World"
property folder: str

The folder where this .ini file resides

If IniFile.file is set to None, then will return the folder where this script is ran

Getter:

Retrieves the folder

Type:

str

getFixCredit() str

Retrieves the credit text for the code generated in the .ini file

Returns:

The credits to be displayed in the .ini file

Return type:

str

getFixFooter() str

Retrieves the footer text used to identify a code section has been changed by this fix in the .ini file

Returns:

The footer section comment to be used in the .ini file

Return type:

str

getFixHeader() str

Retrieves the header text used to identify a code section has been changed by this fix in the .ini file

Returns:

The header section comment to be used in the .ini file

Return type:

str

getFixModTypeHeadingname()

Retrieves the name of the type of mod corresponding to the .ini file to be used in the header/footer divider comment of the fix

Returns:

The name for the type of mod to be displayed in the header/footer divider comment

Return type:

Optional[str]

getFixModTypeName() str | None

Retrieves the name of the type of mod corresponding to the .ini file to be used for the comment of the fix

Returns:

The name for the type of mod corresponding to the .ini file

Return type:

Optional[str]

getFixStr(fix: str = '') str

Generates the newly added code in the .ini file for the fix

Parameters:

fix (str) –

Any existing text we want the result of the fix to add onto

Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

classmethod getFixedBlendFile(blendFile: str, modName: str = '') str

Retrieves the file path for the fixed RemapBlend.buf file

Parameters:
  • blendFile (str) – The file path to the original Blend.buf file

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapBlend.buf file

Return type:

str

classmethod getFixedTexFile(texFile: str, modName: str = '') str

Retrieves the file path for the fixed RemapTex.dds file

Parameters:
  • texFile (str) – The file path to the original .dds file

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapTex.dds file

Return type:

str

getHeadingName()

Retrieves the title for the header of the divider comment of the fix

Returns:

The title for the header of the divider comment

Return type:

str

getIfTemplates(flush: bool = False) Dict[str, IfTemplate]

Retrieves all the :class:`IfTemplate`s for the .ini file

Note

This is the same as IniFile.readIfTemplates(), but uses caching

Parameters:

flush (bool) – Whether to re-parse the :class:`IfTemplates`s instead of using the saved cached values

Returns:

The parsed IfTemplate`s :raw-html:`

Return type:

Dict[str, IfTempalte]

classmethod getMergedResourceIndex(mergedResourceName: str) int | None

Retrieves the index number of a resource created by GIMI’s genshin_merge_mods.py script

Examples

>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.8")
8
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.Score.-100")
-100
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend.UnitTests")
None
>>> IniFile.getMergedResourceIndex("ResourceCuteLittleEiBlend")
None
Parameters:

mergedResourceName (str) – The name of the section

Returns:

The index for the resource section, if found and the index is an integer

Return type:

Optional[int]

classmethod getModSuffixedName(name: str, suffix: str = '', modName: str = '')

Changes a section name to have the suffix of ‘modName’ followed by ‘suffix’

Parameters:
  • name (str) – The name of the section

  • suffix (str) –

    The name of the suffix to put at the end of the section

    Default: ""

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the added suffix keyword

Return type:

str

classmethod getRemapBlendName(name: str, modName: str = '') str

Changes a section name to have the keyword ‘RemapBlend’ to identify that the section is created by this fix

Examples

>>> IniFile.getRemapBlendName("EiTriesToUseBlenderAndFails", "Raiden")
"EiTriesToUseRaidenRemapBlenderAndFails"
>>> IniFile.getRemapBlendName("EiBlendsTheBlender", "Yae")
"EiBlendsTheYaeRemapBlender"
>>> IniFile.getRemapBlendName("ResourceCuteLittleEi", "Raiden")
"ResourceCuteLittleEiRaidenRemapBlend"
>>> IniFile.getRemapBlendName("ResourceCuteLittleEiRemapBlend", "Raiden")
"ResourceCuteLittleEiRemapRaidenRemapBlend"
Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the added ‘RemapBlend’ keyword

Return type:

str

classmethod getRemapBlendResourceName(name: str, modName: str = '') str

Changes the name of a section to be a new resource that this fix will create

Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the prefix ‘Resource’ and the keyword ‘Remap’ added

Return type:

str

classmethod getRemapFixName(name: str, modName: str = '') str

Changes a section name to have the suffix RemapFix to identify that the section is created by this fix

Examples

>>> IniFile.getRemapFixName("EiIsDoneWithRemapFix", "Raiden")
"EiIsDoneWithRaidenRemapFix"
>>> IniFile.getRemapFixName("EiIsHappy", "Raiden")
"EiIsHappyRaidenRemapFix"
Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the added ‘RemapFix’ keyword

Return type:

str

classmethod getRemapFixResourceName(name: str, modName: str = '')

Changes a section name to be a new non-blend resource created by this fix

Note

See IniFile.getResourceName() and IniFile.getRemapFix() for more info

Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the prefix ‘Resource’ and the suffix ‘RemapFix’ added

Return type:

str

classmethod getRemapTexName(name: str, modName: str = '')

Changes a section name to have the suffix RemapFix to identify that the section is created by this fix

Examples

>>> IniFile.getRemapTexName("EiIsDoneWithRemapTex", "Raiden")
"EiIsDoneWithRaidenRemapTex"
>>> IniFile.getRemapTexName("EiIsHappy", "Raiden")
"EiIsHappyRaidenRemapTex"
Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the added ‘RemapFix’ keyword

Return type:

str

classmethod getRemapTexResourceName(name: str, modName: str = '')

Changes a section name to be a texture resource created by this fix

Parameters:
  • name (str) – The name of the section

  • modName (str) –

    The name of the mod to fix

    Default: ""

Returns:

The name of the section with the prefix ‘Resource’ and the suffix ‘RemapFix’ added

Return type:

str

classmethod getResourceName(name: str) str

Makes the name of a section to be used for the resource sections of a .ini file

Examples

>>> IniFile.getResourceName("CuteLittleEi")
"ResourceCuteLittleEi"
>>> IniFile.getResourceName("ResourceCuteLittleEi")
"ResourceCuteLittleEi"
Parameters:

name (str) – The name of the section

Returns:

The name of the section as a resource in a .ini file

Return type:

str

classmethod getResources(commandsGraph: IniSectionGraph, isIfTemplateResource: Callable[[IfContentPart], Any], getIfTemplateResource: Callable[[IfContentPart], str], addResource: Callable[[Any, IfContentPart], Any])

Retrieves all the referenced resources that were called by sections related to the [TextureOverride.*Blend.*] sections

Parameters:
  • resources (Set[str]) – The result for all the resource sections that were referenced

  • commandsGraph (IniSectionGraph) – The subgraph for all the sections related to the resource

  • isIfTemplateResource (Callable[[IfContentPart], bool]) – Checks whether a part in the IfTemplate of a section contains the key that reference the target resource

  • getIfTemplateResource (Callable[[IfContentPart], Any]) – Function to retrieve the target resource from a part in the IfTemplate of a section

  • addResource (Callable[[Any, IfContentPart], Any]) –

    Function to add in the result of the found resource section


    The parameter order for the function is:

    1. the retrieved resource section

    2. the part in the IfTemplate where the resource is found

getTexAddModels() List[IniTexModel]

Retrieves all the file path data needed for creating new texture .dds file (transforms IniFile.texAddModels to a list)

Returns:

The data models needed for editting a texture .dds file

Return type:

List[IniTexModel]

getTexEditModels() List[IniTexModel]

Retrieves all the file path data needed for editing a texture .dds file (transforms IniFile.texEditModels to a list)

Returns:

The data models needed for editting a texture .dds file

Return type:

List[IniTexModel]

property isFixed: bool

Whether the .ini file has already been fixed

Getter:

Returns whether the .ini file has already been fixed

Type:

bool

property isModIni: bool

Whether the .ini file belongs to a mod

Getter:

Returns whether the .ini file belongs to a mod

Type:

bool

makeResourceModel(ifTemplate: ~FixRaidenBoss2.model.iftemplate.IfTemplate.IfTemplate, toFix: ~typing.Set[str], getFixedFile: ~typing.Callable[[str, str], str] | None = None, iniResourceModelCls: ~typing.Type[~FixRaidenBoss2.model.iniresources.IniResourceModel.IniResourceModel] = <class 'FixRaidenBoss2.model.iniresources.IniResourceModel.IniResourceModel'>, iniResModelArgs: ~typing.List[~typing.Any] | None = None, iniResModelKwargs: ~typing.Dict[str, ~typing.Any] | None = None) IniResourceModel

Creates the data needed for fixing a particular [Resource.*] section in the .ini file

Parameters:
  • ifTemplate (IfTemplate) – The particular section to extract data

  • toFix (Set[str]) – The names of the mods to fix

  • getFixedFile (Optional[Callable[[str, str], str]]) –

    The function for transforming the file path of a found resource file into a new file path for the fixed resources file

    If this value is None, then will use IniFile.getFixedBlendFile()

    The parameters for the function are:

    # The path to the original file # The type of mod to fix to

    Default: None

  • iniResourceModelCls (Type[IniResourceModel]) –

    A subclass of IniResourceModel for constructing the required data

    Attention

    The constructor of this subclass must at least have the same arguments and keyword arguments as the constructor for IniResourceModels

    Default: IniResourceModel

  • iniResModelArgs (Optional[List[Any]]) –

    Any arguments to add onto the contructor for creating the subclass of a IniResourceModel

    Default: None

  • iniResModelKwargs (Optional[Dict[str, Any]]) –

    Any keyword arguments to add onto the constructor for creating the subclass of a IniResourceModel

    Default: None

Returns:

The data for fixing the particular resource

Return type:

IniResourceModel

makeTexModel(ifTemplate: IfTemplate, toFix: Set[str], texEditors: BaseTexEditor | Dict[int, Dict[str, List[BaseTexEditor]]], getFixedFile: Callable[[str, str], str] | None = None) IniTexModel

Creates the data needed for fixing a particular [Resource.*] section for some .dds texture file in the .ini file

Parameters:
  • ifTemplate (IfTemplate) – The particular section to extract data

  • toFix (Set[str]) – The names of the mods to fix

  • texEditors (Union[BaseTexEditor, Dict[int, Dict[str, List[BaseTexEditor]]]]) –

    The texture editors for editting the found .dds files

    • If this argument is of type BaseTexEditor, then all .dds files encountered within the parsed section will use the same texture editor

    • If this argument is a dictionary, then the structure of the dictionary is follows the same structure as IniTexModel.texEdits

  • getFixedFile (Optional[Callable[[str, str], str]]) –

    The function for transforming the file path of a found .dds file into a new file path to the fixed .dds file

    If this value is None, then will use IniFile.getFixedBlendFile()

    The parameters for the function are:

    # The path to the original file # The type of mod to fix to

    Default: None

Returns:

The data for fixing the particular texture

Return type:

IniTexModel

parse()

Parses the .ini file

Raises:

KeyError – If a certain resource section is not found

(either the name of the section is not found in the .ini file or the section was skipped due to some error when parsing the section)

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any

read() str

Reads the .ini file

If IniFile.file is set to None, then will read the existing value from IniFile.fileTxt

Returns:

The text content of the .ini file

Return type:

str

readFileLines() List[str]

Reads each line in the .ini file

If IniFile.file is set to None, then will read the existing value from IniFile.fileLines

Returns:

All the lines read from the .ini file

Return type:

List[str]

readIfTemplates() Dict[str, IfTemplate]

Parses all the :class:`IfTemplate`s for the .ini file

Returns:

The parsed IfTemplate`s :raw-html:`

Return type:

Dict[str, IfTempalte]

classmethod removeResourceName(name: str) str

Removes the ‘Resource’ prefix from a section’s name

Examples

>>> IniFile.removeResourceName("ResourceCuteLittleEi")
"CuteLittleEi"
>>> IniFile.removeResourceName("LittleMissGanyu")
"LittleMissGanyu"
Parameters:

name (str) – The name of the section

Returns:

The name of the section with the ‘Resource’ prefix removed

Return type:

str

removeSectionOptions(section: str | Pattern | Callable[[str], bool])

Removes a certain type of section from the .ini file

Parameters:

section (Union[str, Pattern, Callable[[str], bool]]) – The type of section to remove

property type: ModType | None

The type of mod the .ini file belongs to

Getter:

Returns the type of mod the .ini file belongs to

Type:

Optional[ModType]

write(txt: str | None = None) str

Writes back into the .ini files based off the content in IniFile._fileLines

Parameters:

txt (Optional[str]) –

The text to write back into the .ini file

If this argument is None, then will use the IniFile.fileTxt

Default: none

Returns:

The text that is written to the .ini file

Return type:

str


BlendFile

Attributes
Methods
class BlendFile(src: str | bytes)

This Class inherits from File

Used for handling blend.buf files

Note

We observe that a Blend.buf file is a binary file defined as:

  • each line contains 32 bytes (256 bits)

  • each line uses little-endian mode (MSB is to the right while LSB is to the left)

  • the first 16 bytes of a line are for the blend weights, each weight is 4 bytes or 32 bits (4 weights/line)

  • the last 16 bytes of a line are for the corresponding indices for the blend weights, each index is 4 bytes or 32 bits (4 indices/line)

  • the blend weights are floating points while the blend indices are unsigned integers

Parameters:

src (Union[str, bytes]) – The source file or bytes for the blend file

src

The source file or bytes for the blend file

Type:

Union[str, bytes]

_data

The bytes read from the source

Type:

bytes

correct(vgRemap: VGRemap, fixedBlendFile: str | None = None) str | None | bytearray

Fixes a Blend.buf file

Parameters:
  • vgRemap (VGRemap) – The vertex group remap for correcting the Blend.buf file

  • fixedBlendFile (Optional[str]) –

    The file path for the fixed Blend.buf file

    Default: None

Raises:
  • BlendFileNotRecognized – If the original Blend.buf file provided by the parameter blendFile cannot be read

  • BadBlendData – If the bytes passed into this function do not correspond to the format defined for a Blend.buf file

Returns:

If the argument fixedBlendFile is None, then will return an array of bytes for the fixed Blend.buf file

Otherwise will return the filename to the fixed RemapBlend.buf file if the provided Blend.buf file got corrected

Return type:

Union[Optional[str], bytearray]

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any

read() bytes

Reads the bytes in the blend.buf file

Returns:

The read bytes

Return type:

bytes


TextureFile

Attributes
Methods
class TextureFile(src: str)

This Class inherits from File

Used for handling .dds files

img

The associated image file for the texture

Type:

Optional[PIL.Image]

open(format: str = 'RGBA') Image

Opens the texture file

Parameters:

format (str) –

What format the image of the texture file should be opened as

Default: “RGBA”

Returns:

The image for the texture file

Return type:

PIL.Image

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any

read(format: str = 'RGBA', flush: bool = False) List[List[Tuple[int, int, int, int]]] | None

Reads the pixels of the texture .dds file, if the file exists

Parameters:
  • format (str) –

    What format to open the texture file

    Default: “RGBA”

  • flush (bool) –

    Whether to reopen the texture file

    Default: False

Returns:

The pixels for the texture file with RGBA channels

Return type:

Optional[PIL.PixelAccess]

save(img: Image | None = None)

Saves the pixels defined at ‘img’ to the texture .dds file

Parameters:

img (Optional[PIL.Image]) –

the new image to set for the texture file

Default: None



Ini Parts

The different parts that are within a .ini file.


IfTemplate

Methods
class IfTemplate(parts: List[IfTemplatePart], name: str = '')

Data for storing information about a section in a .ini file


Note

Assuming every if/else clause must be on its own line, we have that an IfTemplate have a form looking similar to this:

 1...(does stuff)...
 2...(does stuff)...
 3if ...(bool)...
 4    if ...(bool)...
 5        ...(does stuff)...
 6    else if ...(bool)...
 7        ...(does stuff)...
 8    endif
 9else ...(bool)...
10    if ...(bool)...
11        if ...(bool)...
12            ...(does stuff)...
13        endif
14    endif
15endif
16...(does stuff)...
17...(does stuff)...

We split the above structure into parts (IfTemplatePart) where each part is either:

  1. An If Predicate Part (:class:`IfPredPart`): a single line containing the keywords “if”, “else” or “endif”
    OR

  2. A Content Part (:class:`IfContentPart`): a group of lines that “does stuff”

Note that: an ifTemplate does not need to contain any parts containing the keywords “if”, “else” or “endif”. This case covers the scenario when the user does not use if..else statements for a particular section

Based on the above assumptions, we can assume that every [section] in a .ini file contains this IfTemplate


Supported Operations:

for element in x

Iterates over all the parts of the IfTemplate, x

x[num]

Retrieves the part from the IfTemplate, x, at index num

x[num] = newPart

Sets the part at index num of the IfTemplate, x, to have the value of newPart


Parameters:
parts

The individual parts of how we divided an IfTemplate described above

Type:

List[IfTemplatePart]

calledSubCommands

Any other sections that this IfTemplate references

Type:

Dict[int, List[str]]

hashes

The hashes this IfTemplate references

Type:

Set[str]

indices

The indices this IfTemplate references

Type:

Set[str]

add(part: str | Dict[str, Any])

Adds a part to the ifTemplate

Parameters:

part (Union[str, Dict[str, Any]]) – The part to add to the IfTemplate

find(pred: Callable[[int, IfTemplatePart], bool] | None = None, postProcessor: Callable[[int, IfTemplatePart], Any] | None = None) Dict[int, Any]

Searches the IfTemplate for parts that meet a certain condition

Parameters:
  • pred (Optional[Callable[[IfTemplate, int, IfTemplatePart], bool]]) –

    The predicate used to filter the parts

    If this value is None, then this function will return all the parts

    The order of arguments passed into the predicate will be:

    1. The IfTemplate that this method is calling from

    2. The index for the part in the IfTemplate

    3. The current part of the IfTemplate

    Default: None

  • postProcessor (Optional[Callable[[IfTemplate, int, IfTemplatePart], Any]]) –

    A function that performs any post-processing on the found part that meets the required condition

    The order of arguments passed into the post-processor will be:

    1. The IfTemplate that this method is calling from

    2. The index for the part in the IfTemplate

    3. The current part of the IfTemplate

    Default: None

Returns:

The filtered parts that meet the search condition

The keys are the index locations of the parts and the values are the found parts

Return type:

Dict[int, Any]

getMods(hashRepo: Hashes, indexRepo: Indices, version: float | None = None) Set[str]

Retrieves the corresponding mods the IfTemplate will fix to

Parameters:
  • hashRepo (Hashes) – The data source for the hashes

  • indexRepo (Indices) – The data source for the indices

  • version (Optional[float]) –

    What version we want to fix

    If this value is None, will assume we want to fix to the latest version

    Default: None

Returns:

Names of all the types of mods the IfTemplate will fix to

Return type:

Set[str]


IfTemplatePart

Methods
class IfTemplatePart

Base class for some part in an IfTemplates

toStr() str

Retrieves the part as a string

Returns:

The string representation of the part

Return type:

str


IfPredPart

Attributes
Methods
class IfPredPart(pred: str, type: IfPredPartType)

This class inherits from IfTemplatePart

Class for defining the predicate part of an IfTemplate

Note

see IfTemplate for more details

Parameters:
pred

The predicate string within the IfTemplate

Type:

str

type

The type of predicate encountered

Type:

IfPredPartType

toStr() str

Retrieves the part as a string

Returns:

The string representation of the part

Return type:

str


IfContentPart

Attributes
class IfContentPart(src: Dict[str, List[Tuple[int, str]]], depth: int)

This class inherits from IfTemplatePart

Class for defining the content part of an IfTemplate

Note

see IfTemplate for more details


Supported Operations:

key in x

Determines if ‘key’ exists in the content part of the IfContentPart

x[key]

Retrieves the corresponding data value from the IfContentPart based off ‘key’

  • If ‘key’ is an int, then will retrieve a tuple containing:

    1. The corresponding key for the KVP found

    2. The corresponding value to the found KVP

    3. The occurence index for the key of the KVP

  • Otherwise, will retrieve the corresponding value from IfContentPart.src()

for key, val, keyInd, orderInd in x

Iterates over all the key/value initializations and updates within the IfContentPart, x

The tuples to iterate over are as follows:

  1. key: (str) A particular key in the IfContentPart

  2. val: (str) The corresponding value to the key

  3. keyInd: (int) The occurence index of the same key within the IfContentPart

  4. orderInd: (:class:``int) The order index the KVP appears in the overall IfContentPart

Parameters:
  • src (Dict[str, List[Tuple[int, str]]]) –

    The source for the part in the IfTemplate

    • The keys are the name of the keys in the part

    • The values are the coresponding values for the keys for all instances where the particular key got instantiated/updated. Each element in the list contains:

      1. The order index the KVP was called within the part

      2. The value of the KVP

  • depth (int) – The depth the part is within the IfTemplate

src

The source for the part in the IfTemplate

  • The keys are the name of the keys in the part

  • The values are the coresponding values for the keys for all instances where the particular key got instantiated/updated. Each element in the list contains:
    1. The order index the KVP was called within the part

    2. The value of the KVP

Type:

Dict[str, List[Tuple[int, str]]]

depth

The depth the part is within the IfTemplate

Type:

int

_order
The order the `KVP`_s appear in the part. The elements contain:
  1. The name of the key for the KVP

  2. The occurence index of the key within the part

Type:

List[Tuple[str, int]]

addKVP(key: str, value: str)

Adds a new KVP into the part

Parameters:
  • key (str) – The name of the key

  • value (str) – The corresponding value to the key

getVals(key: str) List[str]

Retrieves the corresponding values based off ‘key’

Parameters:

key (str) – The key to the values belong to

Returns:

The corresponding values found for the key

Return type:

List[str]

remapKeys(keyRemap: Dict[str, List[str]])

Remaps the keys in the `KVP`_s of the parts

Parameters:

keyRemap (Dict[str, List[str]]) –

The remap for the keys

The keys are the old names of the keys to be remapped and the values are the new names of the keys to be remapped to

Warning

Recommeded that the new names in each list to be unique. Otherwise, this function will make each list to have unique values.

removeKey(key: str | Tuple[str, Callable[[Tuple[int, str]], bool]])

Removes a key from the part.

Parameters:

key (str) –

The key to remove.

  • If given only a string, will delete all instances of the key.

  • If given a tuple containing a string and a predicate, will delete all the keys that satisfy the predicate. The predicate takes in a tuple that contains:

    1. The order index where the corresponding KVP appeared

    2. The corresponding value for the KVP

removeKeys(keys: Set[str | Tuple[str, Callable[[Tuple[int, str]], bool]]])

Removes multiple keys from the part

Parameters:

keys (Set[Union[str, Callable[[Tuple[int, str]], bool]]]) –

The keys to remove.

  • If given only a string, will delete all instances of the key.

  • If given a tuple containing a string and a predicate, will delete all the keys that satisfy the predicate. The predicate takes in a tuple that contains:

    1. The order index where the corresponding KVP appeared

    2. The corresponding value for the KVP

replaceVals(newVals: Dict[str, str | List[str] | Tuple[str, Callable[[str], bool]]], addNewKVPs: bool = True)

Replaces the values in the `KVP`_s of the parts or adds in new `KVP`_s if the original key did not exist

Parameters:
  • newVals (Dict[str, Union[str, List[str], Tuple[str, Callable[[str], bool]]]]) –

    The new values for the KVP`_s in the parts :raw-html:`<br />

    • The keys are the corresponding keys for the `KVP`_s

    • The values can either contain:

      • A string, which represents the new value for all instances of the key OR

      • A list of strings, representing the individual new values for each instance of the key OR

      • A tuple containing a string and a predicate, representing the new value for certain instances of the key that satisfy the predicate. The predicate takes in the old value of the KVP as an argument

  • addNewKVPs (bool) –

    Whether to add new KVPs if the corresponding key in ‘newVals’ does not exist

    Default: None

property src

The raw content of the part

  • The keys are the names of the keys in the content part of the IfTemplate. Note that the same key can appear multiple times in a particular content part.

  • The values consists of:
    1. The order index the KVP appeared in the IfContentPart

    2. The corresponding value for the key

Getter:

Retrieves the raw content of the part

Setter:

Sets the raw content for the part

Type:

Dict[str, List[int, str]]

toStr(linePrefix: str = '') str

Retrieves the part as a string

Parameters:

linePrefix (str) –

The string that will prefix every line

Default: None

Returns:

The string representation of the part

Return type:

str


IniSectionGraph

class IniSectionGraph(targetSections: Set[str] | List[str], allSections: Dict[str, IfTemplate], remapNameFunc: Callable[[str, str], str] | None = None, modsToFix: Set[str] | None = None)

Class for constructing a directed subgraph for how the sections in the .ini file are ran


Note

  • The nodes are the sections of the .ini file

  • The directed edges are the command calls from the sections , where the source of the edge is the caller and the sink of the edge is the callee

Parameters:
  • sections (Set[str]) – Names of the desired sections we want our subgraph to have from the sections of the .ini file

  • allSections (Dict[str, IfTemplate]) –

    All the sections for the .ini file


    Note

    You can think of this as the adjacency list for the directed graph of all sections in the .ini file

  • remapNameFunc (Optional[Callable[[str, str], str]]) –

    Function to get the corresponding remap names for the section names

    If this value is None, then will not get the remap names for the sections

    The parameters for the function are:

    1. Name of the section

    2. Name fo the type of mod to fix

    Default: False

  • modsToFix (Optional[Set[str]]) –

    The names of the mods that will be fixed by the .ini file

    Default: None

remapNameFunc

Function to get the corresponding remap names for the section names

The parameters for the function are:

  1. Name of the section

  2. Name fo the type of mod to fix

Type:

Optional[Callable[[str, str], str]]

_dfsExplore(section: IfTemplate, visited: Dict[str, IfTemplate], runSequence: List[Tuple[str, IfTemplate]])

The typical recursive implementation of DFS for exploring a particular section (node)

Parameters:
property allSections

All the sections of the .ini file


Note

You can think of this as the adjacency list for the directed graph of all sections in the .ini file

Getter:

All the sections for the .ini file

Setter:

Constructs a new subgraph based on the new sections for the .ini file

Type:

Dict[str, IfTemplate]

build(newTargetSections: Set[str] | List[str] | None = None, newAllSections: Dict[str, IfTemplate] | None = None, newModsToFix: Set[str] | None = None)

Performs the initialization for rebuilding the subgraph

Parameters:
  • newTargetSections (Optional[Set[str], List[str]]) –

    The new desired sections we want in our subgraph

    Default: None

  • newAllSections (Optional[Dict[str, IfTemplate]]) –

    The new sections for the .ini file

    Default: None

  • newModsToFix (Optional[Set[str]]) –

    The new desired names of the mods that we want to fix for the .ini file

    Default: None

construct() Dict[str, IfTemplate]

Constructs the subgraph for the sections using DFS

Returns:

The sections that are part of the subgraph

Return type:

Dict[str, IfTemplate]

getCommonMods(hashRepo: Hashes, indexRepo: Indices, version: float | None = None) Set[str]

Retrieves the common mods to fix to based off all the :class:`IfTemplate`s in the graph

Parameters:
  • hashRepo (Hashes) – The data source for all the hashes

  • indexRepo (Indices) – The data source for all the indices

  • version (Optional[float]) –

    The version we want to fix to

    If this value is None, then will assume we want to fix to the latest version

    Default: None

Returns:

The common mods to fix to

Return type:

Set[str]

getRemapBlendNames(newModsToFix: Set[str] | None = None) Dict[str, Dict[str, str]]

Retrieves the corresponding remap names of the sections made by this fix

Parameters:

newModsToFix (Optional[Set[str]]) –

The new desired names of the mods that we want to fix for the .ini file

Default: None

Returns:

The new names for the sections with the ‘FixRemap’ keyword added

Return type:

Dict[str, str]

getSection(sectionName: str, raiseException: bool = True) IfTemplate | None

Retrieves the IfTemplate for a certain section

Parameters:
  • sectionName (str) – The name of the section

  • raiseException (bool) – Whether to raise an exception when the section’s IfTemplate is not found

Raises:

KeyError – If the IfTemplate for the section is not found and raiseException is set to True

Returns:

The corresponding IfTemplate for the section

Return type:

Optional[IfTemplate]

property modsToFix

The names of the mods that will be fixed by the .ini file

Getter:

Retrieves the names of the mods to fix

Type:

Set[str]

property remapNames

The corresponding names for the sections that the fix will make

  • The outer key is the name of the original section

  • The inner key is the name for the type of mod to fix

  • The inner value is the corresponding name for the section and mod type

Getter:

All the corresponding names for the sections

Type:

Dict[str, Dict[str, str]]

property runSequence

The order the sections will be ran

Getter:

Retrieves the order the sections will be ran

Type:

List[Tuple[str, IfTemplate]]

property sections

The sections that are part of the contructed subgraph based on the desired sections specified at IniSectionGraph.targetSections


Note

You can think of this as the adjacency list for the subgraph

Getter:

All the sections for the subgraph

Type:

Dict[str, IfTemplate]

property targetSections

Names of the desired sections we want our subgraph to have from the sections of the .ini file

Getter:

The names of the desired sections we want in the subgraph

Setter:

Constructs a new subgraph based on the new desired sections we want

Type:

List[str]



Ini Parsers

Entities to help read and analyze a .ini file.


BaseIniParser

Attributes
Methods
class BaseIniParser(iniFile: IniFile)

Base class to parse a .ini file

Parameters:

iniFile (IniFile) – The .ini file to parse

_modsToFix

The name of the mods that will be fixed to

Type:

Set[str]

_iniFile

The .ini file that will be parsed

Type:

IniFile

clear()

Clears any saved data

parse()

Parses the .ini file


IniParseBuilder

Methods
class IniParseBuilder(cls: Type[BaseIniParser], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)

This class inherits from Builder

A class to help dynamically build a BaseIniParser

Parameters:
  • cls (Type[BaseIniParser]) – The class to construct a BaseIniFixer

  • args (Optional[List[Any]]) –

    The constant arguments used to build the object

    Default: None

  • kwargs (Optional[Dict[str, Any]]) –

    The constant keyword arguments used to build the object

    Default: None

build(iniFile: IniFile) BaseIniParser

Builds the parser

Parameters:

iniFile (IniFile) – The .ini file to parse

Returns:

The built parser

Return type:

BaseIniParser


GIMIParser

class GIMIParser(iniFile: IniFile)

This class inherits from BaseIniParser

Parses a .ini file used by a GIMI related importer

Parameters:

iniFile (IniFile) – The .ini file to parse

blendCommandsGraph

All the sections that use some [Resource.*Blend.*] section.

Type:

IniSectionGraph

nonBlendHashIndexCommandsGraph

All the sections that are not used by the [Resource.*Blend.*] sections and contains the target hashes/indices that need to be replaced

Type:

IniSectionGraph

resourceCommandsGraph

All the related sections to the [Resource.*Blend.*] sections that are used by sections related to the [TextureOverride.*Blend.*] sections. The keys are the name of the sections.

Type:

IniSectionGraph

_makeRemapModels(resourceGraph: IniSectionGraph, getFixedFile: Callable[[str], str] | None = None) Dict[str, IniResourceModel]

Creates all the data needed for fixing the [Resource.*Blend.*] sections in the .ini file

Parameters:
  • resourceGraph (IniSectionGraph) – The graph of sections for the resources

  • getFixedFile (Optional[Callable[[str], str]]) –

    The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file

    If this value is None, then will use IniFile.getFixedBlendFile()

    Default: None

Returns:

The data for fixing the resource sections

The keys are the original names for the resource sections and the values are the required data for fixing the sections

Return type:

Dict[str, IniResourceModel]

_setToFix() Set[str]

Sets the names for the types of mods that will used in the fix

Returns:

The names of the mods that will be used in the fix

Return type:

Set[str]

clear()

Clears any saved data

parse()

Parses the .ini file


GIMIObjParser

class GIMIObjParser(iniFile: IniFile, objs: Set[str], texEdits: Dict[str, Dict[str, Dict[str, BaseTexEditor]]] | None = None)

This class inherits from GIMIParser

Parses a .ini file used by a GIMI related importer and parses section’s related to a specific mod object (head, body, dress, etc…)

Note

For the specific names of the objects for a particular mod, please refer to GIMI Assets

Parameters:
  • iniFile (IniFile) – The .ini file to parse

  • objs (Set[str]) – The specific mod objects to keep track of

  • texEdits (Optional[Dict[str, Dict[str, Dict[str, BaseTexEditor]]]]) –

    texture resource sections that require to be editted

    • The outer keys ares the name of the mod object the texture resource belongs in

    • The second outer keys are the name of the register the texture resource belongs in

    • The inner keys are the names of the type of texture files that are editted

    • The inner value is the editor for changing the texture files

    Note

    The new names of the texture files to be editted should be all unique



    Default: None

objGraphs

The different sections related to each mod object

The keys are the names of the objects and the values are the graphs related to each object

Type:

Dict[str, IniSectionGraph]

texGraphs

The different sections related to the textures to be editted

  • The outer keys are the name of the mod object

  • The inner keys are the name of the register within the mod object

  • The inner value are the graphs for each register specified

Type:

Dict[str, Dict[str, IniSectionGraph]]

_objSearchPatterns

The Regex patterns used to find the roots of the sections related to each mod object

The keys are the names of the objects and the values are the Regex patterns

Type:

Dict[str, Pattern]

_objRootSections

The root sections for each mod object

The keys are the names of the objects and the values are the names of the sections

Type:

Dict[str, Set[str]]

texEditRegs

The corresponding register for a particular texture resource to be editted

  • The keys are the names of the type of texture resource to edit

  • The values contains info about the corresponding register for the texture. The tuple contains:
    1. The name of the mod object the texture resource belongs to

    2. The name of the register that holds the texture

Type:

Dict[str, Tuple[str, str]]

_makeRemapModels(resourceGraph: IniSectionGraph, getFixedFile: Callable[[str], str] | None = None) Dict[str, IniResourceModel]

Creates all the data needed for fixing the [Resource.*Blend.*] sections in the .ini file

Parameters:
  • resourceGraph (IniSectionGraph) – The graph of sections for the resources

  • getFixedFile (Optional[Callable[[str], str]]) –

    The function for transforming the file path of a found .*Blend.buf file into a .*RemapBlend.buf file

    If this value is None, then will use IniFile.getFixedBlendFile()

    Default: None

Returns:

The data for fixing the resource sections

The keys are the original names for the resource sections and the values are the required data for fixing the sections

Return type:

Dict[str, IniResourceModel]

_makeTexModels(texName: str, texGraph: IniSectionGraph, texEditor: BaseTexEditor, getFixedFile: Callable[[str], str] | None = None) Dict[str, Dict[str, IniTexModel]]

Creates all the data needed for fixing the [Resource.*] sections related to texture files in the .ini file

Parameters:
  • texName (str) – The name for the type of texture file to edit

  • texGraph (IniSectionGraph) – The graph of sections for the particular type of textures

  • getFixedFile (Optional[Callable[[str], str]]) –

    The function for transforming the file path of a found from the texture .dds file into a .*RemapFix.dds file

    If this value is None, then will use IniFile.getFixedTexFile()

    Default: None

Returns:

The data for fixing the resource sections

  • The outer keys are the names for the particular type of texture files

  • The inner keys are the names for the resrouce sections

  • The values are the required data for fixing the sections

Return type:

Dict[str, Dict[str, IniTexModel]]

_setToFix() Set[str]

Sets the names for the types of mods that will used in the fix

Returns:

The names of the mods that will be used in the fix

Return type:

Set[str]

clear()

Clears any saved data

getTexEditor(texName: str) BaseTexEditor | None

Retrieves the corresponding BaseTexEditor based on ‘texName’

Parameters:

texName (str) – The name to the type of texture file to be editted

Returns:

The found texture editor

Return type:

Optional[BaseTexEditor]

getTexGraph(texName: str) IniSectionGraph | None

Retrieves the corresponding IniSectionGraph based on ‘texName’

Parameters:

texName (str) – The name to the type of texture file to be editted

Returns:

The found section graph

Return type:

Optional[IniSectionGraph]

getTexGraphs(texNames: List[str]) List[IniSectionGraph]

Retrieves the corresponding section graphs based on ‘texNames’

Parameters:

texNames (List[str]) – The names to the type of texture files to be editted

Returns:

The found section graphs

Return type:

List[IniSectionGraph]

property objs

The specific mod objects to keep track of

Getter:

Returns the names of the mod objects

Setter:

Sets the new names for the mod objects to keep track of

Type:

Set[str]

parse()

Parses the .ini file

property texEdits

texture resource sections that require to be editted

  • The outer keys ares the name of the mod object the texture resource belongs in

  • The second outer keys are the name of the register the texture resource belongs in

  • The inner keys are the names of the type of texture files that are editted

  • The inner value is the editor for changing the texture files

Getter:

Returns the specific registers to have their textures editted

Setter:

Sets the new registers to have their textures editted

Type:

Dict[str, Dict[str, Dict[str, BaseTexEditor]]]



Ini Fixers

The classes below help perform correction on .ini files after the .ini file has been parsed by the Ini Parsers


BaseIniFixer

class BaseIniFixer(parser: BaseIniParser)

Base class to fix a .ini file

Parameters:

parser (BaseIniParser) – The associated parser to retrieve data for the fix

_parser

The associated parser to retrieve data for the fix

Type:

BaseIniParser

_iniFile

The .ini file that will be fixed

Type:

IniFile

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

getFix(fixStr: str = '') str

Retrieves the text to fix the .ini file


IniFixBuilder

Methods
class IniFixBuilder(cls: Type[BaseIniFixer], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)

This class inherits from Builder

Class to dynamically build a BaseIniFixer to fix .ini files

Parameters:
  • cls (Type[BaseIniFixer]) – The class to construct a BaseIniFixer

  • args (Optional[List[Any]]) –

    The constant arguments used to build the object

    Default: None

  • kwargs (Optional[Dict[str, Any]]) –

    The constant keyword arguments used to build the object

    Default: None

build(parser: BaseIniParser) BaseIniFixer

Builds the fixer

Parameters:

parser (BaseIniParser) – The corresponding parser for the .ini file

Returns:

The built fixer

Return type:

BaseIniFixer


GIMIFixer

class GIMIFixer(parser: GIMIParser)

This class inherits from BaseIniFixer

Fixes a .ini file used by a GIMI related importer

Parameters:

parser (GIMIParser) – The associated parser to retrieve data for the fix

_fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixMod(modName: str, fix: str = '') str

Generates the newly added code in the .ini file for the fix of a single type of mod

Note

eg.

If we are making the fix from Jean -> JeanCN and JeanSeaBreeze, The code below will only make the fix for JeanCN

fixMod("JeanCN")
Parameters:
  • modName (str) – The name of the mod to fix

  • fix (str) –

    Any existing text we want the result of the fix to add onto

    Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

getFix(fixStr: str = '')

Retrieves the text to fix the .ini file


GIMIObjReplaceFixer

class GIMIObjReplaceFixer(parser: GIMIObjParser, preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, preRegEditOldObj: bool = True)

This class inherits from GIMIFixer

Base class to fix a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are replaced by other mod objectss

Parameters:
  • parser (GIMIObjParser) – The associated parser to retrieve data for the fix

  • preRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart. Filters are executed based on the order specified in the list.

    Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by GIMIObjReplaceFixer.preRegEditOldObj

    Default: None

  • postRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

    Note

    These filters are preceded by the filters at GIMIObjReplaceFixer.preRegEditFilters


    Default: None

  • preRegEditOldObj (bool) –

    Whether the register editting filters at GIMIObjReplaceFixer.preRegEditFilters reference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods

    Default: True

preRegEditOldObj

Whether the register editting filters at GIMIObjReplaceFixer.preRegEditFilters reference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods

Type:

bool

addedTextures

The textures to be newly created

  • The outer keys are the name of the mod objects

  • The inner keys are the name of the registers

  • The inner values is a tuple that contains:

    # The name of the texture # The texture creator for making the new texture

eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummyShadowRamp", :class:`Colour`())}}

Type:

Dict[str, Dict[str, Tuple[str, TexCreator]]]

_fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*] sections of a texture file

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • texName (str) – The name of the type of texture file

  • oldModName (str) – The name of the type of mod to fix froms

  • modObjName (str) – The name of the type of mod object associated to the section

  • texGraph (IniSectionGraph) – The graph where the section belongs to

Returns:

The created content part

Return type:

str

_fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

_getTexEditFile(file: str, texInd: int, modName: str = '') str

Makes the file path for an editted texture

Parameters:
  • texFile (str) – The file path to the original .dds file

  • texInd (int) – The index for the type of texture being editted

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapTex.dds file

Return type:

str

clear()

Clears all the saved states

editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])

Edits the registers for a IfContentPart

Note

For details on steps of how the registers are editted, see GIMIObjReplaceFixer

Parameters:
  • modName (str) – The name of the mod

  • part (IfContentPart) – The part that is being editted

  • obj (str) – The name of the mod object for the corresponding part

  • sectionName (str) – The name of the section the part belongs to

  • filters (List[BaseRegEditFilter]) – The filters used for editting the registers

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections of some mod object, where the original section comes from a different mod object

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • objName (str) – The name of the original mod object

  • newObjName (str) – The name of the mod object to fix to

Returns:

The created content part

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixMod(modName: str, fix: str = '') str

Generates the newly added code in the .ini file for the fix of a single type of mod

Note

eg.

If we are making the fix from Jean -> JeanCN and JeanSeaBreeze, The code below will only make the fix for JeanCN

fixMod("JeanCN")
Parameters:
  • modName (str) – The name of the mod to fix

  • fix (str) –

    Any existing text we want the result of the fix to add onto

    Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

getFix(fixStr: str = '')

Retrieves the text to fix the .ini file

getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str

Retrieves the new name of the section for a new mod object

Parameters:
  • name (str) – The name of the section

  • modName (str) – The name of the mod to be fixed

  • objName (str) – The name of the original mod object for the section

  • newObjName (str) – The name of the new mod object for the section

Returns:

The new name for the section

Return type:

str

getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str

Retrieves the new name of the section for a texture resource that is created/editted

Parameters:
  • texTypeName (str) – The name of the type of texture file

  • oldModName (str) – The name of the mod to fix from

  • newModName (str) – The name of the mod to fix to

  • objName (str) – The mod object the texture resource refereces

  • addInd (bool) –

    Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type

    Default: False

Returns:

The new name for the section

Return type:

str

property postRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]

property preRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the original mod objects to be fixed. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]


GIMIObjSplitFixer

class GIMIObjSplitFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None, preRegEditOldObj: bool = False)

This class inherits from GIMIObjReplaceFixer

Fixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are split into multiple mod objects in remapped mod

eg.

 KeqingOpulent's "body" is split into Keqing's "body" and "dress"

 KeqingOpulent             Keqing
===============       =================
*** objects ***       **** objects ****
    body  -------+------>   body
    head         |          head
                 +------>   dress

Note

For the order of how the registers are fixed, please see GIMIObjReplaceFixer

Parameters:
  • parser (GIMIObjParser) – The associated parser to retrieve data for the fix

  • objs (Dict[str, List[str]]) –

    The mod objects that will be split into multiple new mod objects

    The keys are the names of the mod objects to be split and the values are the names of the new mod objects the original mod object will be split into

    Note

    The dictionary keys should align with the defined object names at GIMIObjParser.objs() for your parser


    Warning

    If multiple mod objects split into the same object, then the resultant .ini file will contain duplicate sections for that particular mod object

    eg.
    {"body": ["dress", "extra"], "head": ["face", "extra"]}

  • preRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart. Filters are executed based on the order specified in the list.

    Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by GIMIObjSplitFixer.preRegEditOldObj

    Default: None

  • postRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

    Note

    These filters are preceded by the filters at GIMIObjReplaceFixer.preRegEditFilters


    Default: None

  • preRegEditOldObj (bool) –

    Whether the register editting filters at GIMIObjReplaceFixer.preRegEditFilters reference the original mod objects of the mod to be fixed or the new mod objects of the fixed mods

    Default: False

_fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*] sections of a texture file

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • texName (str) – The name of the type of texture file

  • oldModName (str) – The name of the type of mod to fix froms

  • modObjName (str) – The name of the type of mod object associated to the section

  • texGraph (IniSectionGraph) – The graph where the section belongs to

Returns:

The created content part

Return type:

str

_fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

_getTexEditFile(file: str, texInd: int, modName: str = '') str

Makes the file path for an editted texture

Parameters:
  • texFile (str) – The file path to the original .dds file

  • texInd (int) – The index for the type of texture being editted

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapTex.dds file

Return type:

str

clear()

Clears all the saved states

editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])

Edits the registers for a IfContentPart

Note

For details on steps of how the registers are editted, see GIMIObjReplaceFixer

Parameters:
  • modName (str) – The name of the mod

  • part (IfContentPart) – The part that is being editted

  • obj (str) – The name of the mod object for the corresponding part

  • sectionName (str) – The name of the section the part belongs to

  • filters (List[BaseRegEditFilter]) – The filters used for editting the registers

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections of some mod object, where the original section comes from a different mod object

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • objName (str) – The name of the original mod object

  • newObjName (str) – The name of the mod object to fix to

Returns:

The created content part

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixMod(modName: str, fix: str = '') str

Generates the newly added code in the .ini file for the fix of a single type of mod

Note

eg.

If we are making the fix from Jean -> JeanCN and JeanSeaBreeze, The code below will only make the fix for JeanCN

fixMod("JeanCN")
Parameters:
  • modName (str) – The name of the mod to fix

  • fix (str) –

    Any existing text we want the result of the fix to add onto

    Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

getFix(fixStr: str = '')

Retrieves the text to fix the .ini file

getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str

Retrieves the new name of the section for a new mod object

Parameters:
  • name (str) – The name of the section

  • modName (str) – The name of the mod to be fixed

  • objName (str) – The name of the original mod object for the section

  • newObjName (str) – The name of the new mod object for the section

Returns:

The new name for the section

Return type:

str

getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str

Retrieves the new name of the section for a texture resource that is created/editted

Parameters:
  • texTypeName (str) – The name of the type of texture file

  • oldModName (str) – The name of the mod to fix from

  • newModName (str) – The name of the mod to fix to

  • objName (str) – The mod object the texture resource refereces

  • addInd (bool) –

    Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type

    Default: False

Returns:

The new name for the section

Return type:

str

property objs: Dict[str, List[str]]

The mods objects that will be split to multiple other mod objects

The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod

Getter:

Retrieves the mods objects

Setter:

Sets the new objects

Type:

Dict[str, List[str]]

property postRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]

property preRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the original mod objects to be fixed. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]


GIMIObjMergeFixer

class GIMIObjMergeFixer(parser: GIMIObjParser, objs: Dict[str, List[str]], copyPreamble: str = '', preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None)

This class inherits from GIMIObjReplaceFixer

Fixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap are merged to a single mod object

eg.

 Keqing's "body" and "dress" are merged into KeqingOpulent's "body"

    Keqing             KeqingOpulent
===============       =================
*** objects ***       **** objects ****
    body      -----+---->   body
    head           |        head
    dress     -----+

Note

This class takes advantage of GIMI’s bug/feature of overlapping mods from loading multiple mods of the same character by creating different variations of the original .ini file

Parameters:
  • parser (GIMIObjParser) – The associated parser to retrieve data for the fix

  • objs (Dict[str, List[str]]) –

    The mod objects to be merged to a single mod object

    The keys are the names of the merged objects and the values are the names of the mod objects to be merged

    Note

    The dictionary values should align with the defined object names at GIMIObjParser.objs() for your parser

  • copyPreamble (str) –

    Any text we want to put before the text of the newly generated .ini file variations

    Default: ""

  • preRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart. Filters are executed based on the order specified in the list.

    Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by GIMIObjMergeFixer.preRegEditOldObj

    Default: None

  • postRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

    Note

    These filters are preceded by the filters at GIMIObjReplaceFixer.preRegEditFilters


    Default: None

_targetObjs

Which original mod objects to show for each merged mod object in the current .ini file

The keys are the names of the original mod objects to display on the current .ini file and the values are the names of the merged objects.

Type:

Dict[str, str]

copyPreamble

Any text we want to put before the text of the newly generated .ini file variations

Type:

str

_fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*] sections of a texture file

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • texName (str) – The name of the type of texture file

  • oldModName (str) – The name of the type of mod to fix froms

  • modObjName (str) – The name of the type of mod object associated to the section

  • texGraph (IniSectionGraph) – The graph where the section belongs to

Returns:

The created content part

Return type:

str

_fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

_getTexEditFile(file: str, texInd: int, modName: str = '') str

Makes the file path for an editted texture

Parameters:
  • texFile (str) – The file path to the original .dds file

  • texInd (int) – The index for the type of texture being editted

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapTex.dds file

Return type:

str

clear()

Clears all the saved states

editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])

Edits the registers for a IfContentPart

Note

For details on steps of how the registers are editted, see GIMIObjReplaceFixer

Parameters:
  • modName (str) – The name of the mod

  • part (IfContentPart) – The part that is being editted

  • obj (str) – The name of the mod object for the corresponding part

  • sectionName (str) – The name of the section the part belongs to

  • filters (List[BaseRegEditFilter]) – The filters used for editting the registers

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections of some mod object, where the original section comes from a different mod object

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • objName (str) – The name of the original mod object

  • newObjName (str) – The name of the mod object to fix to

Returns:

The created content part

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixMod(modName: str, fix: str = '') str

Generates the newly added code in the .ini file for the fix of a single type of mod

Note

eg.

If we are making the fix from Jean -> JeanCN and JeanSeaBreeze, The code below will only make the fix for JeanCN

fixMod("JeanCN")
Parameters:
  • modName (str) – The name of the mod to fix

  • fix (str) –

    Any existing text we want the result of the fix to add onto

    Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

getFix(fixStr: str = '')

Retrieves the text to fix the .ini file

getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str

Retrieves the new name of the section for a new mod object

Parameters:
  • name (str) – The name of the section

  • modName (str) – The name of the mod to be fixed

  • objName (str) – The name of the original mod object for the section

  • newObjName (str) – The name of the new mod object for the section

Returns:

The new name for the section

Return type:

str

getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str

Retrieves the new name of the section for a texture resource that is created/editted

Parameters:
  • texTypeName (str) – The name of the type of texture file

  • oldModName (str) – The name of the mod to fix from

  • newModName (str) – The name of the mod to fix to

  • objName (str) – The mod object the texture resource refereces

  • addInd (bool) –

    Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type

    Default: False

Returns:

The new name for the section

Return type:

str

property objs

The mod objects to be merged to a single mod object

The keys are the names of the merged objects and the values are the names of the mod objects to be merged

Getter:

Retrieves the mod objects to be merged

Setter:

Set the new mod objects to be merged

Type:

Dict[str, List[str]]

property postRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]

property preRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the original mod objects to be fixed. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]


GIMIObjRegEditFixer

class GIMIObjRegEditFixer(parser: GIMIObjParser, preRegEditFilters: List[BaseRegEditFilter] | None = None, postRegEditFilters: List[BaseRegEditFilter] | None = None)

This class inherits from GIMIObjSplitFixer

Fixes a .ini file used by a GIMI related importer where particular mod objects (head, body, dress, etc…) in the mod to remap needs to have their registers remapped or removed

Note

For the order of how the registers are fixed, please see GIMIObjReplaceFixer

Parameters:
  • parser (GIMIObjParser) – The associated parser to retrieve data for the fix

  • preRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart. Filters are executed based on the order specified in the list.

    Whether these filters reference the mod objects to be fixed of the new mod objects of the fixed mods is determined by GIMIObjRegEditFixer.preRegEditOldObj

    Default: None

  • postRegEditFilters (Optional[List[BaseRegEditFilter]]) –

    Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

    Note

    These filters are preceded by the filters at GIMIObjReplaceFixer.preRegEditFilters


    Default: None

_fillNonBlendSections(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillRemapResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_fillTexResource(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, texName: str, oldModName: str, modObjName: str, texGraph: IniSectionGraph)

Creates the content part of an IfTemplate for the new sections created by this fix related to the [Resource.*] sections of a texture file

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [Resource.*Blend.*] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • texName (str) – The name of the type of texture file

  • oldModName (str) – The name of the type of mod to fix froms

  • modObjName (str) – The name of the type of mod object associated to the section

  • texGraph (IniSectionGraph) – The graph where the section belongs to

Returns:

The created content part

Return type:

str

_fillTextureOverrideRemapBlend(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str) str

Creates the content part of an IfTemplate for the new sections created by this fix related to the [TextureOverride.*Blend.*] sections

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

Returns:

The created content part

Return type:

str

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

_getTexEditFile(file: str, texInd: int, modName: str = '') str

Makes the file path for an editted texture

Parameters:
  • texFile (str) – The file path to the original .dds file

  • texInd (int) – The index for the type of texture being editted

  • modName (str) – The name of the mod to fix to

Returns:

The file path of the fixed RemapTex.dds file

Return type:

str

clear()

Clears all the saved states

editRegisters(modName: str, part: IfContentPart, obj: str, sectionName: str, filters: List[BaseRegEditFilter])

Edits the registers for a IfContentPart

Note

For details on steps of how the registers are editted, see GIMIObjReplaceFixer

Parameters:
  • modName (str) – The name of the mod

  • part (IfContentPart) – The part that is being editted

  • obj (str) – The name of the mod object for the corresponding part

  • sectionName (str) – The name of the section the part belongs to

  • filters (List[BaseRegEditFilter]) – The filters used for editting the registers

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fillObjNonBlendSection(modName: str, sectionName: str, part: IfContentPart, partIndex: int, linePrefix: str, origSectionName: str, objName: str, newObjName: str)

Creates the content part of an IfTemplate for the new sections created by this fix that are not related to the [TextureOverride.*Blend.*] sections of some mod object, where the original section comes from a different mod object

Tip

For more info about an ‘IfTemplate’, see IfTemplate

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name for the section

  • part (IfContentPart) – The content part of the IfTemplate of the original [TextureOverrideBlend] section

  • partIndex (int) – The index of where the content part appears in the IfTemplate of the original section

  • linePrefix (str) – The text to prefix every line of the created content part

  • origSectionName (str) – The name of the original section

  • objName (str) – The name of the original mod object

  • newObjName (str) – The name of the mod object to fix to

Returns:

The created content part

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

fixMod(modName: str, fix: str = '') str

Generates the newly added code in the .ini file for the fix of a single type of mod

Note

eg.

If we are making the fix from Jean -> JeanCN and JeanSeaBreeze, The code below will only make the fix for JeanCN

fixMod("JeanCN")
Parameters:
  • modName (str) – The name of the mod to fix

  • fix (str) –

    Any existing text we want the result of the fix to add onto

    Default: “”

Returns:

The text for the newly generated code in the .ini file

Return type:

str

getFix(fixStr: str = '')

Retrieves the text to fix the .ini file

getObjRemapFixName(name: str, modName: str, objName: str, newObjName: str) str

Retrieves the new name of the section for a new mod object

Parameters:
  • name (str) – The name of the section

  • modName (str) – The name of the mod to be fixed

  • objName (str) – The name of the original mod object for the section

  • newObjName (str) – The name of the new mod object for the section

Returns:

The new name for the section

Return type:

str

getTexResourceRemapFixName(texTypeName: str, oldModName: str, newModName: str, objName: str, addInd: bool = False) str

Retrieves the new name of the section for a texture resource that is created/editted

Parameters:
  • texTypeName (str) – The name of the type of texture file

  • oldModName (str) – The name of the mod to fix from

  • newModName (str) – The name of the mod to fix to

  • objName (str) – The mod object the texture resource refereces

  • addInd (bool) –

    Whether to add a unique numbered index to the end of the name to distingusih the name from other previously created names of the same texture type

    Default: False

Returns:

The new name for the section

Return type:

str

property objs: Dict[str, List[str]]

The mods objects that will be split to multiple other mod objects

The keys are the names of the objects in the mod to be remapped and the values are the split objects of the remapped mod

Getter:

Retrieves the mods objects

Setter:

Sets the new objects

Type:

Dict[str, List[str]]

property postRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the new mod objects of the fixed mods. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]

property preRegEditFilters

Filters used to edit the registers of a certain IfContentPart for the original mod objects to be fixed. Filters are executed based on the order specified in the list.

Getter:

Retrieves all the sequence of filters

Setter:

Sets the new sequence of filters

Type:

List[BaseRegEditFilter]


MultiModFixer

class MultiModFixer(parser: BaseIniParser, fixBuilders: Dict[str, IniFixBuilder])

This class inherits from BaseIniFixer

Fixes a .ini file where each mod to fix requires a different BaseIniFixer strategy

Parameters:
  • parser (BaseIniParser) – The associated parser to retrieve data for the fix

  • fixBuilders (Dict[str, IniFixBuilder]) –

    The different builders to dynamcally construct the BaseIniFixer used for each mod to fix

    The keys are the names of the mods to fix and the values are the different IniFixBuilder used to construct the BaseIniFixer to fix the mod

_fixBuilders

The different builders to dynamcally construct the BaseIniFixer used for each mod to fix

The keys are the names of the mods to fix and the values are the different IniFixBuilder used to construct the BaseIniFixer to fix the mod

Type:

Dict[str, IniFixBuilder]

_fixers

The different fixers to fix each type of mod

The keys are the names of the mods to fix and the values are the fixers to fix the mod

Type:

Dict[str, BaseIniFixer]

_getAsset(assetType: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the corresponding asset

Parameters:
  • assetType (str) – The name for the type of asset to retrieve

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the asset for

  • notFoundVal (Any) –

    The value to be returned if the replacement is not found

    Default: None

Returns:

The found asset or the value from ‘notFoundVal’ if the asset was not found

Return type:

Union[str, Any]

_getAssetReplacement(asset: str, assetRepoAttName: str, modName: str, notFoundVal: Any | None = None) str | Any

Retrieves the replacement for ‘asset’

Parameters:
  • asset (str) – The asset to be replaced

  • assetRepoAttName (str) – The name of the ModIdAssets repo in IniFile.availableType()

  • modName (str) – The name of the mod we want the replacement for

  • notFoundVal (Any) –

    The value to be returns if the replacement is not found

    Default: None

Returns:

The found replacement asset or the value from ‘notFoundVal’ if the replacement was not found

Return type:

Union[str, Any]

_getHash(hashType: str, modName: str) str

Retrieves the corresponding hash

Parameters:
  • hashType (str) – The name for the type of hash to retrieve

  • modName (str) – The name for the type of mod to get the hash from

Returns:

The found hash or “HashNotFound” if the corresponding hash is not found

Return type:

str

_getHashReplacement(hash: str, modName: str) str

Retrieves the replacement for ‘hash’

Parameters:
  • hash (str) – The hash to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the hash or “HashNotFound” if there are not replacements

Return type:

str

_getIndex(indexType: str, modName: str) str

Retrieves the corresponding index

Parameters:
  • indexType (str) – The name for the type of index to retrieve

  • modName (str) – The name for the type of mod to get the index from

Returns:

The found index or “IndexNotFound” if the corresponding index is not found

Return type:

str

_getIndexReplacement(index: str, modName: str) str

Retrieves the replacement for ‘index’

Parameters:
  • index (str) – The index to be replaced

  • modName (str) – The name of the mod we want the replacement for

Returns:

The corresponding replacement for the index or “IndexNotFound” if there are not replacements

Return type:

str

buildFixers()

Rebuilds the BaseIniFixer used for each mod

fillIfTemplate(modName: str, sectionName: str, ifTemplate: IfTemplate, fillFunc: Callable[[str, str, IfContentPart, int, int, str], str], origSectionName: str | None = None) str

Creates a new IfTemplate for an existing section in the .ini file

Parameters:
  • modName (str) – The name for the type of mod to fix to

  • sectionName (str) – The new name of the section

  • ifTemplate (IfTemplate) – The IfTemplate of the orginal section

  • fillFunc (Callable[[str, str, IfContentPart, int, str, str], str]]) –

    The function to create a new content part for the new IfTemplate

    Tip

    For more info about an ‘IfTemplate’, see IfTemplate


    The parameter order for the function is:

    1. The name for the type of mod to fix to

    2. The new section name

    3. The corresponding content part in the original IfTemplate

    4. The index for the content part in the original IfTemplate

    5. The string to prefix every line in the content part of the IfTemplate

    6. The original name of the section

  • origSectionName (Optional[str]) –

    The original name of the section.

    If this argument is set to None, then will assume this argument has the same value as the argument for sectionName

    Default: None

Returns:

The text for the newly created IfTemplate

Return type:

str

fix(keepBackup: bool = True, fixOnly: bool = False, update: bool = False) str | List[str]

Fixes the .ini file

Parameters:
  • keepBackup (bool) –

    Whether to keep backups for the .ini file

    Default: True

  • fixOnly (bool) –

    Whether to only fix the .ini file without undoing any fixes

    Default: False

  • update (bool) –

    Whether to also update the source text in the IniFile object with the latest fix

    Default: False

Returns:

The new content of the .ini file which includes the fix and the new content of any other newly created .ini files related to fixing the particular .ini file

Return type:

Union[str, List[str]]

getFix(fixStr: str = '') str

Retrieves the text to fix the .ini file



Ini Removers

These entities help remove fixes from .ini files that were made from previous runs.


BaseIniRemover

Attributes
Methods
class BaseIniRemover(iniFile: IniFile)

Base class to remove fixes from a .ini file

Parameters:

iniFile (IniFile) – The .ini file to remove the fix from

iniFile

The .ini file that will be parsed

Type:

IniFile

static _readLines(func)

Decorator to read all the lines in the .ini file first before running a certain function

All the file lines will be saved in IniFile._fileLines

Examples

1@_readLines
2def printLines(self):
3    for line in self.iniFile.fileLines:
4        print(f"LINE: {line}")
remove(parse: bool = False) str

Removes the fix from the .ini file

Parameters:

parse (bool) –

Whether to also parse for the .*RemapBlend.buf files that need to be removed

Default: False

Returns:

The new content of the .ini file

Return type:

str


IniRemoveBuilder

Attributes
Methods
class IniRemoveBuilder(cls: Type[BaseIniRemover], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None, cache: bool = True)

This class inherits from FlyweightBuilder

A class to help dynamically build a BaseIniRemover

Parameters:
  • cls (Type[BaseIniRemover]) – The class to construct a BaseIniRemover

  • args (Optional[List[Any]]) –

    The constant arguments used to build the object

    Default: None

  • kwargs (Optional[Dict[str, Any]]) –

    The constant keyword arguments used to build the object

    Default: None

  • cache (bool) –

    Whether to cache the built object

    Default: True

cache

Whether to cache the built object

Type:

bool

build(iniFile: IniFile) BaseIniRemover

Builds the remover

Parameters:

iniFile (IniFile) – The .ini file to parse

Returns:

The built remover

Return type:

BaseIniRemover


IniRemover

Attributes
Methods
class IniRemover(iniFile: IniFile)

This class inherits from BaseIniRemover

Class for the basic removal of the fixes from .ini files

Parameters:

iniFile (IniFile) – The .ini file to remove the fix from

static _readLines(func)

Decorator to read all the lines in the .ini file first before running a certain function

All the file lines will be saved in IniFile._fileLines

Examples

1@_readLines
2def printLines(self):
3    for line in self.iniFile.fileLines:
4        print(f"LINE: {line}")
remove(parse: bool = False) str

Removes the fix from the .ini file

Parameters:

parse (bool) –

Whether to also parse for the .*RemapBlend.buf files that need to be removed

Default: False

Returns:

The new content of the .ini file

Return type:

str



Register Editting Filters

Used for subclasses of the GIMIObjRegEditFixer class to handle editting registers within an IfTemplate in the .ini file


BaseRegEditFilter

Methods
class BaseRegEditFilter

Base class for editting registers within an IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart


RegEditFilter

Methods
class RegEditFilter

This class inherits from BaseRegEditFilter

class for editting registers within an IfContentPart

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers


RegNewVals

Attributes
Methods
class RegNewVals(vals: Dict[str, Dict[str, str | Callable[[str], bool]]] | None = None)

This class inherits from RegEditFilter

Class for assigning new values to specific registers for some IfContentPart

Parameters:

vals

Defines which registers will have their values changed

  • The outer keys are the names of the new mod objects where the registers are found

  • The inner keys are the new names of the registers to have their values changed

  • The inner values contains either

    • A string representing the new changed values for all instances of the register OR

    • A tuple containing a string and a predicate, representing the new changed values for only certain instances of the registers. The predicate takes the old value of the register as the argument.

eg.
{"head": {"ps-t1": "newVal"}, "body": {"ps-t3": "newVal2", "ps-t0": "newVal3"}, "dress": {"ps-t0": ("newVal4", lambda val: val == "replaceMe")}}

vals

Defines which registers will have their values changed

  • The outer keys are the names of the new mod objects where the registers are found

  • The inner keys are the new names of the registers to have their values changed

  • The inner values contains either

    • A string representing the new changed values for all instances of the register OR

    • A tuple containing a string and a predicate, representing the new changed values for only certain instances of the registers. The predicate takes the old value of the register as the argument.

Type:

Dict[str, Dict[str,Union[str, Tuple[str, Callable[[str], bool]]]]]

_regUpdates

The value updates to do on the current IfContentPart being parsed

The keys are the names of the registers and the values are the corresponding values to the registers

Type:

Optional[Dict[str, str]]

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers


RegRemap

Attributes
Methods
class RegRemap(remap: Dict[str, Dict[str, List[str]]] | None = None)

This class inherits from RegEditFilter

Class for remapping the register keys for some IfContentPart

Parameters:

remap (Optional[Dict[str, Dict[str, List[str]]]]) –

Defines how the register values in the parts of an IfTemplate are mapped to a new register in the remapped mod for particular mod objects

  • The outer keys are the name of the mod object to have their registers remapped

  • The inner keys are the names of the registers that hold the register values to be remapped

  • The inner values are the new names of the registers that will hold the register values

eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": ["ps-t8"]}}

Default: None

remap

Defines how the register values in the parts of an IfTemplate are mapped to a new register in the remapped mod for particular mod objects

  • The outer keys are the name of the mod objects to have its registers remapped

  • The inner keys are the names of the registers that hold the register values to be remapped

  • The inner values are the new names of the registers that will hold the register values

eg.
{"head": {"ps-t1": ["new_ps-t2", "new_ps-t3"]}, "body": {"ps-t3": [ps-t0"], "ps-t0": [], "ps-t1": ["ps-t8"]}}

Type:

Dict[str, Dict[str, List[str]]]

_regRemap

The register remap to do on the current IfContentPart being parsed

The keys are the names of the registers and the values are the newly mapped registers

Type:

Optional[Dict[str, List[str]]]

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers


RegRemove

Attributes
Methods
class RegRemove(remove: Dict[str, Set[str]] | None = None)

This class inherits from RegEditFilter

Class for removing keys from a IfContentPart

Parameters:

remove (Optional[Dict[str, Set[Union[str, Callable[[Tuple[int, str]], bool]]]]]) –

Defines whether some register assignments should be removed from the sections from the mod objects

  • The keys are the names of the objects to have their registers removed

  • the values are the names of the register to be removed.

    • If given only a string, will remove all instance of the register

    • If given a tuple containing a string and a predicate, will remove instance of the register that satistfy the predicate The predicate takes in a tuple that contains:

      1. The order index where the current KVP of the register resides in the IfContentPart

      2. The corresponding value for the current KVP



eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}

Default: None

remove

Defines whether some register assignments should be removed from the sections from the mod objects

  • The keys are the names of the objects to have their registers removed

  • the values are the names of the register to be removed.

    • If given only a string, will remove all instance of the register

    • If given a tuple containing a string and a predicate, will remove instance of the register that satistfy the predicate The predicate takes in a tuple that contains:

      1. The order index where the current KVP of the register resides in the IfContentPart

      2. The corresponding value for the current KVP



eg.
{"head": {"ps-t1", "ps-t2"}, "body": {"ps-t3", "ps-t0"}}

Type:

Dict[str, Set[str]]

_regRemove

The register removal to do on the current IfContentPart being parsed

Type:

Optional[Set[str]]

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers


RegTexAdd

class RegTexAdd(textures: Dict[str, Dict[str, Tuple[str, TexCreator]]] | None = None, mustAdd: bool = True)

This class inherits from RegEditFilter

Class for adding new texture .dds files to a IfContentPart

Parameters:
  • textures (Optional[Dict[str, Dict[str, Tuple[str, TexCreator, bool]]]]) –

    New texture .dds files to be created

    • The outer key are the names of the mod object

    • The inner keys are the names of the register

    • The inner values contanis:
      1. The name of the type of texture file

      2. The object that will create the new texture file

    eg.
    {"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummyShadowRamp", :class:`Colour`())}}

    Default: None

  • mustAdd (bool) – Whether the texture files will still be created for a particular IfContentPart even if the corresponding register for the texture file does not exist within that particular IfContentPart

textures

New texture .dds files to be created

  • The outer key are the names of the mod object

  • The inner keys are the names of the register

  • The inner values contanis:
    1. The name of the type of texture file

    2. The object that will create the new texture file

eg.
{"head": {"ps-t1": ("EmptyNormalMap", :class:`TexCreator`(4096, 1024))}, "body": {"ps-t3": ("NewLightMap", :class:`TexCreator`(1024, 1024, :class:`Colour`(0, 128, 0, 255))), "ps-t0": ("DummySshadowRamp", :class:`Colour`())}}

Type:

Dict[str, Dict[str, Tuple[str, TexCreator]]]

mustAdd

Whether the texture files will still be created for a particular IfContentPart even if the corresponding register for the texture file does not exist within that particular IfContentPart

Type:

bool

_regAddVals

The texture additions to do on the current IfContentPart being parsed

The keys are the name of the registers and the values are the section names for the textures

Type:

Optional[Dict[str, str]]

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers


RegTexEdit

Attributes
Methods
class RegTexEdit(textures: Dict[str, List[str]] | None = None)

This class inherits from RegEditFilter

Class for editting texture .dds files to a IfContentPart

Parameters:

textures (Optional[Dict[str, List[str]]]) –

Texture .dds files to be editted from existing textures files

  • The keys are the name of the type of texture files of the mod object

  • The values are the name of the registers to hold the editted textures

eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0"], "ShinyMetalMap": ["ps-t2"]}

Default: None

_regEditVals

The texture edits to do on the current IfContentPart being parsed

The keys are the name of the registers and the values are the section names for the textures

Type:

Optional[Dict[str, str]]

_editReg(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

The main function to edit the registers for the current IfContentPart

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

clear()

Clears any saved state within this class

edit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer) IfContentPart

Edits the registers for the current IfContentPart. Includes boilerplate of clearing all saved states and handling texture adds/edits

Note

If you are inheriting this class, you probably want to override the RegEditFilter._editReg() method instead

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

Returns:

The resultant part of the IfTemplate that got its registers editted

Return type:

IfContentPart

handleTexAdd(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

handleTexEdit(part: IfContentPart, modType: ModType, fixModName: str, obj: str, sectionName: str, fixer: GIMIObjReplaceFixer)

Does any post-processing on the added textures of the corresponding GIMIObjReplaceFixer

Parameters:
  • part (IfContentPart) – The part of the IfTemplate that is being editted

  • modType (ModType) – The type of mod that is being fix from

  • fixModName (str) – The name of the mod to fix to

  • obj (str) – The name of the mod object being fixed

  • fixer (GIMIObjReplaceFixer) – The fixer that is editting the registers

property textures: Dict[str, List[str]]

Texture .dds files to be editted from existing textures files

  • The keys are the name of the type of texture files of the mod object

  • The values are the name of the registers to hold the editted textures

eg.
{"NormalMap": ["ps-t1", "r13", "ps-t0"], "ShinyMetalMap": ["ps-t2"]}

Getter:

Retrieves the texture .dds files to be editted by register

Setter:

Sets the textures to be editted

Type:

Dict[str, List[str]]



Models

Some internal data models used in the project.


Model

Attributes
Methods
class Model(logger: Logger | None = None)

Generic class used for any data models in the fix

Parameters:

logger (Optional[Logger]) –

The logger used to print messages to the console

Default: None

logger

The logger used to print messages to the console

Type:

Optional[Logger]

print(funcName: str, *args, **kwargs)

Prints out output

Parameters:
  • funcName (str) – The name of the function in the logger for printing out the output

  • *args (List[str]) – Arguments to pass to the function in the logger

  • **kwargs (Dict[str, Any]) – Keyword arguments to pass to the function in the logger

Returns:

The return value from running the corresponding function in the logger

Return type:

Any


IniResourceModel

class IniResourceModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], origPaths: Dict[int, List[str]] | None = None)

Contains data for fixing a particular resource in a .ini file


Supported Operations:

for fixedPath, fixedFullPath, origPath, origFullPath in x

Iterates over all the fixed paths to some resource within a IfContentPart, x

The tuples to iterate over are as follows: #. fixedPath: (str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available

Parameters:
  • iniFolderPath (str) – The folder path to where the .ini file of the resource is located

  • fixedPaths (Dict[int, Dict[str, List[str]]]) –

    The file paths to the fixed files for the resource

    • The outer keys are the indices to the IfContentPart that the Blend.buf file appears in the IfTemplate for some resource

    • The inner keys are the names for the type of mod to fix to

    • The inner values are the file paths within the IfContentPart

  • origPaths (Optional[Dict[int, List[str]]]) –

    The file paths for the resource



    Default: None

iniFolderPath

The folder path to where the .ini file of the resource is located

Type:

str

fixedPaths

The file paths to the fixed files for the resource

  • The outer keys are the indices to the IfContentPart that the resource files appear in the IfTemplate for some resource

  • The inner keys are the names for the type of mod to fix to

  • The inner values are the file paths within the IfContentPart

Type:

Dict[int, Dict[str, List[str]]]

origPaths

The file paths to the files for the resource

Type:

Optional[Dict[int, List[str]]]

fullPaths

The absolute paths to the fixed RemapBlend.buf files for the resource

  • The outer keys are the indices to the IfContentPart that the files appear in the IfTemplate for some resource

  • The inner keys are the names for the type of mod to fix to

  • The inner values are the file paths within the IfContentPart

Type:

Dict[int, Dict[str, List[str]]]

origFullPaths

The absolute paths to the files for the resource

Type:

Dict[int, List[str]]

clear()

Clears out all the path data stored


IniTexModel

Methods
class IniTexModel(iniFolderPath: str, fixedPaths: Dict[int, Dict[str, List[str]]], texEdits: Dict[int, Dict[str, List[BaseTexEditor]]], origPaths: Dict[int, List[str]] | None = None)

This class inherits from IniResourceModel

Contains data for editting some texture files in a .ini file


Supported Operations:

for fixedPath, fixedFullPath, origPath, origFullPath in x

Iterates over all the fixed paths to some texture within a IfContentPart, x

The tuples to iterate over are as follows: #. fixedPath: (str) The path name of the fixed file #. fixedFullPath: (str) The full path name to the fixed file #. origPath: (Optional[str]) The path to the orignal file, if available #. origFullPath: (Optional[str]) The full path name to the original file, if available

Parameters:
  • iniFolderPath (str) – The folder path to where the .ini file of the resource is located

  • fixedPaths (Dict[int, Dict[str, List[str]]]) –

    The file paths to the fixed files for the resource

    • The outer keys are the indices to the IfContentPart that the .dds files appears in the IfTemplate for some texture

    • The inner keys are the names for the type of mod to fix to

    • The inner values are the file paths within the IfContentPart

  • texEdits (Dict[int, Dict[str, List[BaseTexEditor]]]) –

    The texture editors used to edit the texture

    • The outer keys are the indices to the IfContentPart that the .dds files appears in the IfTemplate for some texture

    • The inner keys are the names for the type of mod to fix to

    • The inner values are the different texture editors used to the .dds files

  • origPaths (Optional[Dict[int, List[str]]]) –

    The file paths for the resource



    Default: None

clear()

Clears out all the path data stored


FileStats

class FileStats

Keeps track of different types of files encountered by the program

fixed

The paths to the fixed files

Type:

Set[str]

skipped

The exceptions to files paths that were skipped due to errors

Type:

Dict[str, Exception]

skippedByMods

The exceptions to file paths that were skipped due to errors, grouped for each mod folder paths

  • The outer keys are the names to the mod folders

  • The inner keys are the names of the file paths

  • The inner values are the errors encountered

Type:

DefaultDict[str, Dict[str, Exception]]

removed

The file paths for files that got removed

Type:

Set[str]

undoed

The file paths for files that got undoed to a previous state before the software was ran

Type:

Set[str]

visitedAtRemoval

The file paths for files that got visited when attempting to remove those files

Type:

Set[str]

addFixed(filePath: str)

Adds a new file path to the paths of fixed files

Parameters:

filePath (str) – the new file path to a fixed file

addRemoved(filePath: str)

Adds in a new file path that got removed

Parameters:

filePath (str) – The file path that got removed

addSkipped(filePath: str, error: Exception, modFolder: str | None = None)

Adds a new file path to the paths of skipped files

Parameters:
  • filePath (str) – the new file path that got skipped

  • error (Exception) – The exception that caused the file to be skipped

  • modFolder (Optional[str]) –

    The mod folder that contains the file path. If this argument is None, will read the folder from the provided argument in filePath

    Default: None

addUndoed(filePath: str)

Adds in a new file path that got undoeds

Parameters:

filePath (str) – The file path that got undoed

addVisitedAtRemoval(filePath: str)

Adds in a new file path that got visited when the software attempts to remove the file

Parameters:

filePath (str) – The file path that got visited when the software attempts to remove the file

clear()

Clears out all saved data about the files

update(modFolder: str | None = None, newFixed: Set[str] | None = None, newSkipped: Dict[str, Exception] | None = None, newRemoved: Set[str] | None = None, newUndoed: Set[str] | None = None, newVisitedAtRemoval: Set[str] | None = None)

Updates the overall file paths in this class

Parameters:
  • modFolder (Optional[str]) –

    The folder where the files got skipped

    Default: None

  • newFixed (Optional[Set[str]]) –

    The newly added file paths that got fixed

    Default: None

  • newSkipped (Optional[Dict[str, Exception]]) –

    The newly skipped file paths due to errors within a particular mod folder

    Default: None

  • newRemoved (Optional[Set[str]]) –

    The newly added file paths that got removed

    Default: None

  • newUndoed (Optional[Set[str]]) –

    The newly added file paths that got contents undoed to a previous state before the software was ran

    Default: None

  • newVisitedAtRemoved (Optional[Set[str]]) –

    The newly added file paths that got visited when the software attempts to remove those files

    Default: None

updateFixed(newFixed: Set[str])

Adds in new fixed file paths

Parameters:

newFixed (Set[str]) – The newly added file paths that got fixed

updateRemoved(newRemoved: Set[str])

Adds in new file paths that got removed

Parameters:

newRemoved (Set[str]) – The newly added file paths that got removed

updateSkipped(newSkipped: Dict[str, Exception], modFolder: str | None = None)

Adds in new file paths that got skipped due to errors

Parameters:
  • newSkipped (Dict[str, Exception]) – The newly skipped file paths due to errors within a particular mod folder

  • modFolder (Optional[str]) – The folder where the files got skipped. If this argument is None, will read the folder from the provided file pahts in newSkipped

updateUndoed(newUndoed: Set[str])

Adds in new file paths that got contents undoed to a previous state before the software was ran

Parameters:

newRemoved (Set[str]) – The newly added file paths that got contents undoed to a previous state before the software was ran

updateVisitedAtRemoval(newVisitedAtRemoval: Set[str])

Adds in new file paths that got visited when the software attempts to remove those files

Parameters:

newVisitedAtRemoved (Set[str]) – The newly added file paths that got visited when the software attempts to remove those files



Texture Editing

Classes to help with editting texture files.


BaseTexEditor

Methods
class BaseTexEditor

Base class to edit some .dds file

fix(texFile: TextureFile, fixedTexFile: str)

Edits the texture file

Parameters:
  • texFile (TextureFile) – The texture .dds file to be modified

  • fixedTexFile (str) – The name of the fixed texture file


TexEditor

class TexEditor(filters: List[BaseTexFilter | Callable[[TextureFile], Any]] | None = None)

This class inherits from BaseTexEditor

Class for editing a texture file

Parameters:

filters (Optional[List[Union[BaseTexFilter, Callable[[TextureFile], Any]]]]) –

The filters for editting the image

Default: None

filters

The filters for editting the image

Default: None

Type:

List[Unsion[BaseTexFilter, Callable[[TextureFile], Any]]]

classmethod adjustBrightness(texFile: TextureFile, brightness: float)

Adjust the brightness of the texture

Parameters:
  • texFile (TextureFile) – The texture file to be editted

  • brightness (float) –

    The brightness to adjust the texture.

    0 => make the image black 1 => original brightness of the image >1 => make the image brighter

classmethod adjustSaturation(texFile: TextureFile, saturation: float)

Adjust the saturation of the texture

Parameters:
  • texFile (TextureFile) – The texture file to be editted

  • brightness (float) –

    The brightness to adjust the texture.

    0 => make the image black and white 1 => original saturation of the image >1 => make the image really saturated like a TV

fix(texFile: TextureFile, fixedTexFile: str)

Edits the texture file

Parameters:
  • texFile (TextureFile) – The texture .dds file to be modified

  • fixedTexFile (str) – The name of the fixed texture file

classmethod setTransparency(texFile: TextureFile, alpha: int)

Sets the transparency of the texture

Parameters:
  • texFile (TextureFile) – The texture file to be editted

  • alpha (int) –

    The value for the alpha (transparency) channel of each pixel. Range from 0 - 255.

    0 => Transparent 255 => Opaque


TexCreator

Methods
class TexCreator(width: int, height: int, colour: Colour | None = None)

This class inherits from BaseTexEditor

Creates a brand new .dds file if the file doe not exist

fix(texFile: TextureFile, fixedTexFile: str)

Edits the texture file

Parameters:
  • texFile (TextureFile) – The texture .dds file to be modified

  • fixedTexFile (str) – The name of the fixed texture file


Colour

class Colour(red: int = 255, green: int = 255, blue: int = 255, alpha: int = 255)

Class to store data for a colour


Supported Operations:

hash(x)

Retrieves the hash id for the colour based off Colour.getId()


Parameters:
  • red (int) –

    The red channel for the colour

    Default: 255

  • green (int) –

    The green channel for the colour

    Default: 255

  • blue (int) –

    The blue channel for the colour

    Default: 255

  • alpha (int) –

    The transparency (alpha) channel for the colour with a range from 0-255. 0 = transparent, 255 = opaque

    Default: 255

red

The red channel for the colour

Type:

int

green

The green channel for the colour

Type:

int

blue

The blue channel for the colour

Type:

int

alpha

The transparency (alpha) channel for the colour with a range from 0-255. 0 = transparent, 255 = opaque

Type:

int

classmethod boundColourChannel(val: int, min: int = 0, max: int = 255)

Makes a colour channel to be in between the minimum and maximum value

Parameters:
  • val (int) – The value of the channel

  • min (int) –

    The minimum bound for the colour channel

    Default: 0

  • max (int) –

    The maximum bound for the colour channel

    Default: 0

copy(colour, withAlpha: bool = True)

Copies the colour value from ‘colour’

Parameters:
  • colour (Colour) – The colour to copy from

  • withAlpha (bool) –

    Whether to also copy the alpha channel

    Default: True

fromTuple(colourTuple: Tuple[int, int, int, int])

Updates the colour based off ‘colourTuple’

Parameters:

colourTuple (Tuple[int, int, int, int]) – The raw values for the colour in RGBA format

getId() str

Retrieves a unique id for the colour

Note

The id generated will not correspond to any id generated from ColourRange.getId()

Returns:

The id for the colour

Return type:

str

getTuple() Tuple[int, int, int, int]

Retrieves the tuple representation of the colour in RGBA format

Returns:

The colour tuple containing the following colour channel values indicated by the order below:

  1. Red

  2. Green

  3. Blue

  4. Alpha

Return type:

Tuple[int, int, int, int]

match(colour)

Whether ‘colour’ matches this colour

Parameters:

colour (Colour) – The colour to check

Returns:

Whether the colour matches this colour

Return type:

bool


ColourRange

Methods
class ColourRange(min: Colour, max: Colour)

Class to store data for a colour


Supported Operations:

hash(x)

Retrieves the hash id for the colour range based off ColourRange.getId()


Parameters:
  • min (Colour) – The minimum range for the RGBA values

  • max (Colour) – The maximum range for the RGBA values

getId() str

Retrieves a unique id for the colour range

Note

The id generated will not correspond to any id generated from Colour.getId()

Returns:

The id for the colour range

Return type:

str

match(colour: Colour) bool

Whether ‘colour’ is within the colour range

Parameters:

colour (Colour) – The colour to check

Returns:

Whether the colour is within the colour range

Return type:

bool



Texture Filters

Classes to transform the image within a TextureFile


BaseTexFilter

Methods
class BaseTexFilter

Base class for transforming a texture file


Supported Operations:

x(texFile)

Calls BaseTexFilter.transform() for the BaseTexFilter, x

transform(texFile: TextureFile)

Applies a Transformation to ‘texFile’

Parameters:

texFile (TextureFile) – The texture to be editteds


GammaFilter

Attributes
Methods
class GammaFilter(gamma: float)

This class inherits from BaseTexFilter

Performs a Gamma Correction on the texture file. See CorrectGamma for more details

Parameters:

gamma (float) – The luminance parameter for how bright humans perceive the image.

gamma

The luminance parameter for how bright humans perceive the image.

Type:

float

transform(texFile: TextureFile)

Applies a Transformation to ‘texFile’

Parameters:

texFile (TextureFile) – The texture to be editteds


InvertAlphaFilter

Methods
class InvertAlphaFilter

This class inherits from BaseTexFilter

Inverts the alpha channel of an image.

transform(texFile: TextureFile)

Applies a Transformation to ‘texFile’

Parameters:

texFile (TextureFile) – The texture to be editteds


HueAdjust

Methods
class HueAdjust(hue: int)

This class inherits from BaseTexFilter

Adjusts the hue of a texture file

Parameters:

hue (int) – The hue to adjust the image. Value is from -180 to 180

_adjustHue(hue: int) int

Adjusts the hue

Parameters:

hue (int) – The current hue that has not been adjust yet

Returns:

The adjusted hue

Return type:

int

transform(texFile: TextureFile)

Applies a Transformation to ‘texFile’

Parameters:

texFile (TextureFile) – The texture to be editteds


PixelFilter

Attributes
Methods
class PixelFilter(transforms: List[BasePixelTransform | Callable[[Colour, int, int], Colour]] | None = None)

This class inherits from BaseTexFilter

Manipulates each pixel within an image

Warning

This filter iterates through every pixel of the image using Python’s for loops. It is recommended to try to use the different filters inherited from the BaseTexFilter class since those filters have more capability to interact with Pillow API or the Numpy API, where their implementation are written at the C++ level, allowing images to be editted A LOT faster.

Parameters:

transforms (Optional[List[Union[BasePixelTransform, Callable[[Colour, int, int], Any]]]]) –

The functions to edit a single pixel in the texture file

The functions take the following parameters:

  1. The RGBA colour of the pixel

  2. The x-coordinate

  3. The y-coordinate


Default: None

transforms

The transformation functions to edit a single pixel in the texture file

Type:

List[Union[BasePixelTransform, Callable[[Colour], Colour]]]

transform(texFile: TextureFile)

Changes each individual pixel in the image

Parameters:

texFile (TextureFile) – The texture to be editteds


TexMetadataFilter

Attributes
Methods
class TexMetadataFilter(edits: Dict[str, Any] | None = None, removes: Set[str] | None = None)

This class inherits from BaseTexFilter

A pseudo-filter used to manipulate the metadata of a texture file (PIL.Image.Image.info)

Warning

Currently, any metadata won’t actually be saved into the texture file due to the image library (Pillow) facing difficulty porting the BCn Encoding Algorithm from C/C# to Python.

https://github.com/python-pillow/Pillow/issues/4864


But the following metadata will affect how this software saves the texture file:

  • gamma

Parameters:
  • edits (Optional[Dict[str, Any]]) –

    The edits to perform on the metadata

    Default: None

  • removes (Optional[Set[str]]) –

    keys to remove from the metadata

    Default: None

edits

The edits to perform on the metadata

Type:

Dict[str, Any]

removes

keys to remove from the metadata

Type:

Set[str]

transform(texFile: TextureFile)

Changes metadata of the image

Parameters:

texFile (TextureFile) – The texture to be editted



Pixel Transforms

Classes to help transform a single pixel within a texture file.


Warning

These transforms are used by the FixRaidenBoss2.PixelFilter class to iterate through every pixel of an image using Python’s for loops. It is recommended to try to use the different filters inherited from the FixRaidenBoss2.BaseTexFilter class since those filters have more capability to interact with Pillow API or the Numpy API, where their implementation are written at the C++ level, allowing images to be editted A LOT faster.


BasePixelTransform

Methods
class BasePixelTransform

Base class for transforming a pixel in a texture file


Supported Operations:

x(pixel, xCoord, yCoord)

Calls BasePixelTransform.transform() for the BasePixelTransform, x

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


ColourReplace

class ColourReplace(replaceColour: Colour, coloursToReplace: Set[Colour | ColourRange] | None = None, replaceAlpha: bool = True)

This class inherits from BasePixelTransform

Replaces a coloured pixel

Paramaters

replaceColour: Colour

The colour to fill in

coloursToReplace: Optional[Set[Union[Colour, ColourRange]]]

The colours to find to be replaced. If this value is None, then will always replace the colour of the pixel

Default: None

replaceAlpha: bool

Whether to also replace the alpha channel of the original colour

Default: True

replaceColour

The colour to fill in

Type:

Colour

coloursToReplace

The colour to find to be replaced. If this value is None, then will always replace the colour of the pixel

Type:

Optional[Set[Union[Colour, ColourRange]]]

replaceAlpha

Whether to also replace the alpha channel of the original colour

Type:

bool

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


CorrectGamma

Attributes
class CorrectGamma(gamma: float)

This class inherits from BasePixelTransform

Performs a Gamma Correction on an individual pixel using the following simple Gamma Correction Algorithm

Parameters:

gamma (float) –

The luminance parameter for how bright humans perceive the image. Based off the following Power Law Relationship`_:

V_out = V_in ^ gamma


Where V_out is the perceived brightness by human eyes while V_in is the actual brightness of the image


Note

higher gamma values make the image look brighter and less saturated while lower gamma values make the image look darker and more saturated.

gamma

The luminance parameter for how bright humans perceive the image.

Type:

float

classmethod correctGamma(pixelValue: int, gamma: float) int

The equation for the gamma correction done at every colour channel pixel

Parameters:
  • pixelValue (int) – The value of the pixel for some colour channel

  • gamma (float) – The luminance parameter for how bright humans perceive the image.

Returns:

The gamma corrected pixel values

Return type:

int

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


HighlightShadow

Attributes
Methods
class HighlightShadow(highlight: float = 0, shadow: float = 0)

This class inherits from BasePixelTransform

A filter that approximates the adjustment of the shadow/hightlight of an image

Parameters:
  • highlight (float) –

    The amount of highlight to apply to the pixel. Range from -1 to 1, and 0 = no change

    Default: 0

  • shadow (float) –

    The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change

    Default: 0

highlight

The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change

Type:

float

shadow

The amount of shadow to apply to the pixel. Range from -1 to 1, and 0 = no change

Type:

float

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


InvertAlpha

Methods
class InvertAlpha

This class inherits from BasePixelTransform

Inverts the alpha channel of a pixel

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


TempControl

Methods
class TempControl(temp: float = 0)

This class inherits from BasePixelTransform

Controls the temperature of a texture file using a modified version of the Simple Image Temperature/Tint Adjust Algorithm such that the colour channels increase/decrease linearly with respect to their corresponding pixel value and the user selected temperature

Parameters:

temp (float) –

The temperature to set the image. Range from -1 to 1

Default: 0

temp

The temperature to set the image. Range from -1 to 1

Type:

float

_redFactor

The rate for how fast the red channel will change

Type:

float

_blueFactor

The rate for how fast the blue channel will change

Type:

float

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


TintTransform

Attributes
Methods
class TintTransform(tint: int = 0)

This class inherits from BasePixelTransform

Controls the tint of a texture file using the Simple Image Temperature/Tint Adjust Algorithm

Parameters:

tint (int) –

The tint to set the image. Range from -100 to 100

Default: 0

tint

The tint to set the image. Range from -100 to 100

Type:

float

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel


Transparency

Attributes
Methods
class Transparency(alphaChange: int)

This class inherits from BasePixelTransform

Adjust the trasparency (alpha channel) for an image

Parameters:

alphaChange (int) –

How much to adjust the alpha channel of each pixel. Range from -255 to 255

Note

The alpha channel for an image is inclusively bounded from 0 to 255

alphaChange

How much to adjust the alpha channel of each pixel. Range from -255 to 255

Type:

int

transform(pixel: Colour, x: int, y: int)

Applies a Transformation to ‘pixel’

Parameters:
  • pixel (Colour) – The pixel to be editted

  • x (int) – x-coordinate of the pixel

  • y (int) – y-coordinate of the pixel



Views

Different display views for the project.


Logger

class Logger(prefix: str = '', logTxt: bool = False, verbose: bool = True)

Class for pretty printing output to display on the console

Parameters:
  • prefix (str) –

    line that is printed before any message is printed out

    Default: “”

  • logTxt (bool) –

    Whether to log all the printed messages into a .txt file once the fix is done

    Default: False

  • verbose (bool) –

    Whether to print out output

    Default: True

includePrefix

Whether to include the prefix string when printing out a message

Type:

bool

verbose

Whether to print out output

Type:

bool

logTxt

Whether to log all the printed messages into a .txt file once the fix is done

Type:

bool

_prefix

line that is printed before any message is printed out

Type:

str

_headings

A stack of headings that have been opened (by calling Heading.open()), but have not been closed yet (have not called Heading.close() yet)

Type:

Deque[Heading]

_loggedTxt

The text that will be logged into a .txt file

Type:

str

_addLogTxt(txt: str)

Appends the text to the logged output to be printed to a .txt file

Parameters:

txt (str) – The text to be added onto the logged output

_setDefaultHeadingAtts()

Sets the default attributes for printing out a header line

box(message: str, header: str)

Prints the message to be sandwiched by the text defined in the argument, header

Parameters:
  • message (str) – The message we want to print out

  • header (str) – The string that we want to sandwich our message against

bulletPoint(txt: str)

Prints out an item in an unordered list

Parameters:

txt (str) – The message we want to print out

clear()

Clears out any saved text from the logger

closeHeading()

Prints out a closing heading that corresponds to a previous opening heading printed (see line 3 of the example at Heading)

error(message: str)

Prints an error message

Parameters:

message (str) – The message we want to print out

classmethod getBulletStr(txt: str) str

Creates the string for an item in an unordered list

Parameters:

txt (str) – The message we want to print out

Returns:

The text formatted as an item in an unordered list

Return type:

str

classmethod getNumberedStr(txt: str, num: int) str

Creates the string for an ordered list

Parameters:
  • txt (str) – The message we want to print out

  • num (str) – The number we want to print out before the text for the ordered list

Returns:

The text formatted as an item in an ordered list

Return type:

str

getStr(message: str)

Retrieves the string to be printed out by the logger

Parameters:

message (str) – The message we want to print out

Returns:

The transformed text that the logger prints out

Return type:

str

handleException(exception: Exception)

Prints the message for an error

Parameters:

exception (Exception) – The error we want to handle

input(desc: str) str

Handles user input from the console

Parameters:

desc (str) – The question/description being asked to the user for input

Returns:

The resultant input the user entered

Return type:

str

list(lst: List[str], transform: Callable[[str], str] | None = None)

Prints out an ordered list

Parameters:
  • lst (List[str]) – The list of messages we want to print out

  • transform (Optional[Callable[[str], str]]) –

    A function used to do any processing on each message in the list of messages

    If this parameter is None, then the list of message will not go through any type of processing

    Default: None

log(message: str)

Regularly prints text onto the console

Parameters:

message (str) – The message we want to print out

property loggedTxt

The text to be logged into a .txt file

Getter:

Returns such a prefix

Type:

str

openHeading(txt: str, sideLen: int = 2, headingChar='=')

Prints out an opening heading

Parameters:
  • txt (str) – The message we want to print out

  • sideLen (int) –

    How many characters we want for the side border of the heading
    (see line 1 of the example at Heading)

    Default: 2

  • headingChar (str) –

    The type of character used to print the side border of the heading
    (see line 3 of the example at Heading)

    Default: “=”

property prefix

The line of text that is printed before any message is printed out

Getter:

Returns such a prefix

Setter:

Sets up such a prefix for the logger

Type:

str

space()

Prints out a space

split()

Prints out a new line

waitExit()

Prints the message used when the script finishes running


Heading

Attributes
Methods
class Heading(title: str = '', sideLen: int = 0, sideChar: str = '=')

Class for handling information about a heading for pretty printing

Examples

1======= Title: Fix Raiden Boss 2 =======
2...
3========================================
Parameters:
  • title (str) –

    The title for the heading

    Default: “”

  • sideLen (int) –

    The number of characters we want one side for the border of the opening heading to have

    Default: 0

  • sideChar (str) –

    The type of character we want the border for the heading to have

    Default: “=”

title

The title for the heading

Type:

str

sideLen

The number of characters we want one side for the border of the opening heading to have

Type:

int

sideChar

The type of character we want the border for the heading to have

Type:

str

close() str

Makes the closing heading (see line 3 of the example at Heading)

Returns:

The closing heading created

Return type:

str

copy()

Makes a new copy of a heading

Returns:

The new copy of the heading

Return type:

Heading

open() str

Makes the opening heading (see line 1 of the example at Heading)

Returns:

The opening heading created

Return type:

str



Enums

Some useful Enumerations and constants.


ModTypes

class ModTypes(value)

The supported types of mods that can be fixed

Caution

The different ModType objects in this enum are used by the software to help fix specific types of mods.

Modifying the objects within this enum will also modify the behaviour of how this software fixes a particular mod. If this side effect is not your intention, then you can construct a brand new ModType object from the GIBuilder class

Amber

Amber mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Amber)((?!(RemapBlend|CN)).)*Blend.*\s*\]

Type:

ModType

AmberCN

Amber Chinese mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(AmberCN)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Ayaka

Ayaka mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Ayaka)((?!(RemapBlend|SpringBloom)).)*Blend.*\s*\]

Type:

ModType

AyakaSpringBloom

Ayaka Fontaine mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(AyakaSpringBloom)((?!(RemapBlend)).)*Blend.*\s*\]

Type:

ModType

Arlecchino

Arlecchino mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Arlecchino)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Barbara

Barabara mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Barbara)((?!RemapBlend|Summertime).)*Blend.*\s*\]

Type:

ModType

BarbaraSummertime

Barabara Summertime mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(BarbaraSummertime)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Diluc

Diluc mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Diluc)((?!RemapBlend|Flamme).)*Blend.*\s*\]

Type:

ModType

DilucFlamme

Diluc Red Dead of the Night mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(DilucFlamme)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Fischl

Fischl mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Fischl)((?!RemapBlend|Highness).)*Blend.*\s*\]

Type:

ModType

FischlHighness

Fischl Highness mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(FischlHighness)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Ganyu

Ganyu mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Ganyu)((?!(RemapBlend|Twilight)).)*Blend.*\s*\]

Type:

ModType

GanyuTwilight

Ganyu Latern Rite mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(GanyuTwilight)((?!(RemapBlend)).)*Blend.*\s*\]

Type:

ModType

Jean

Jean mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Jean)((?!(RemapBlend|CN|Sea)).)*Blend.*\s*\]

Type:

ModType

JeanCN

Jean Chinese mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(JeanCN)((?!RemapBlend|Sea).)*Blend.*\s*\]

Type:

ModType

JeanSea

Jean Summertime mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(JeanSea)((?!RemapBlend|CN).)*Blend.*\s*\]

Type:

ModType

Keqing

Keqing mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Keqing)((?!(RemapBlend|Opulent)).)*Blend.*\s*\]

Type:

ModType

KeqingOpulent

Keqing Lantern Rite mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(KeqingOpulent)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Kirara

Kirara mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Kirara)((?!RemapBlend|Boots).)*Blend.*\s*\]

Type:

ModType

KiraraBoots

Kirara in Boots mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(KiraraBoots)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Klee

Klee mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Klee)((?!RemapBlend|BlossomingStarlight).)*Blend.*\s*\]

Type:

ModType

KleeBlossomingStarlight

**Klee Blossoming Starlight mods*

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(KleeBlossomingStarlight)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Mona

Mona mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Mona)((?!(RemapBlend|CN)).)*Blend.*\s*\]

Type:

ModType

MonaCN

Mona Chinese mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(MonaCN)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Nilou

Nilou mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Nilou)((?!(RemapBlend|Breeze)).)*Blend.*\s*\]

Type:

ModType

NilouBreeze

Nilou Forest Fairy mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(NilouBreeze)((?!(RemapBlend)).)*Blend.*\s*\]

Type:

ModType

Ningguang

Ningguang Chinese mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Ningguang)((?!(RemapBlend|Orchid)).)*Blend.*\s*\]

Type:

ModType

NingguangOrchid

Ningguang Lantern Rite mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(NingguangOrchid)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Raiden

Raiden mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Raiden|Shogun)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Rosaria

Rosaria mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Rosaria)((?!(RemapBlend|CN)).)*Blend.*\s*\]

Type:

ModType

RosariaCN

Rosaria Chinese mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(RosariaCN)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

Shenhe

Shenhe mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(Shenhe)((?!RemapBlend|FrostFlower).)*Blend.*\s*\]

Type:

ModType

ShenheFrostFlower

Shenhe Lantern Rite mods

Checks if the .ini file contains a section with the regex ^\s*\[\s*TextureOverride.*(ShenheFrostFlower)((?!RemapBlend).)*Blend.*\s*\]

Type:

ModType

classmethod getAll() Set[ModType]

Retrieves a set of all the mod types available

Returns:

All the available mod types

Return type:

Set[ModType]

classmethod search(name: str)

Searches a mod type based off the provided name

Parameters:

name (str) – The name of the mod to search for

Returns:

The found mod type based off the provided name

Return type:

Optional[ModType]


IniKeywords

class IniKeywords(value)

Common keywords used in the .ini file

Blend = 'Blend'

The substring that usually occurse in the name of section to indicate that the section will call some *.Blend.buf file

Draw = 'draw'

Location to draw a resource

Filename = 'filename'

The filename for some resource

Handling = 'handling'

Handling

Hash = 'hash'

The unique id for a part in the mod

HashNotFound = 'HashNotFound'

The hash for a mod has not been found

IndexNotFound = 'IndexNotFound'

The index for a mod has not been found

MatchFirstIndex = 'match_first_index'

The index location to map some resource

ORFixPath = 'CommandList\\global\\ORFix\\ORFix'

The sub command call to ORFix

RemapBlend = 'RemapBlend'

The substring used to indicate that the section references some *.RemapBlend.buf file

RemapFix = 'RemapFix'

The substring used to indicate that the section was created by this program

RemapTex = 'RemapTex'

The substring used to indicate that the section contains some editted/created texture *.Remap.dds file

Resource = 'Resource'

The starting prefix used for any sections that reference some file

Run = 'run'

The subsection that will be called from a certain section

TexFxFolder = 'CommandList\\TexFx'

The folder to the sub command call to the TexFx module

Vb1 = 'vb1'

Vertex buffer #1


IfPredPartType

Attributes
class IfPredPartType(value)

Enum for the possible types for an IfPredPart

Elif = 'elif'

The part contains the starting keyword ‘elif’

Else = 'else'

The part contains the staring keyword ‘else’

EndIf = 'endif'

The part contains the staring keyword ‘endif’

If = 'if'

The part contains the staring keyword ‘if’

classmethod getType(rawPredPart: str)

Retrieves the type for an IfPredPart

Parameters:

rawPredPart (str) – The predicate string for the IfPredPart

Returns:

The type found based off ‘rawPredPart’

Return type:

Optional[IfPredPartType]


ColourConsts

class ColourConsts(value)

Constants about colours

MaxColourDegree = 360

Maximum degrees for some HSV/HSL images

MaxColourValue = 255

Maximum bound for a colour channel

MinColourDegree = 0

Minimum degrees for some HSV/HSL images

MinColourValue = 0

Minimum bound for a colour channel

PaintTempDecBlueFactor = 2

The parameter for approximately how fast the blue channel increases for the temperature decrease algorithm from Paint.net

PaintTempDecRedFactor = 0.5

The parameter for approximately how fast the red channel decreases for the temperature decrease algorithm from Paint.net

PaintTempIncBlueFactor = 0.44

The parameter for approximately how fast the blue channel decreases for the temperature increase algorithm from Paint.net

PaintTempIncRedFactor = 0.41

The parameter for approximately how fast the red channel increases for the temperature increase algorithm from Paint.net

SRGBGamma = 0.45454545454545453

The standard gamma value (1/2.2) typically used in computer displays, sRGB images, Adobe RGB images. See CorrectGamma for more info.

StandardGamma = 2.2

The reciprocal of the standard gamma value (1/2.2) used in computer displays, sRGB images, Adobe RGB images. See CorrectGamma for more info.


Colours

class Colours(value)

Some common colours used

White

white

Type:

Colour (255, 255, 255, 255)

LightMapGreenMin

Minimum range for the green colour usually in the LightMap.dds

Type:

Colour (0, 125, 0, 0)

LightMapGreenMax

Maximum range for the green colour usually in the LightMap.dds

Type:

Colour (50, 150, 50, 255)

NormalMapYellow

The yellow that usually appears in the NormalMap.dds

Type:

Colour (128, 128, 0, 255)


ImgFormats

Attributes
class ImgFormats(value)

Different formats for an image

HSV = 'HSV'

HSV (hue, saturation, value) image

RGB = 'RGB'

RGB (red, green blue) image

RGBA = 'RGBA'

RGBA (red, green, blue) image


TexMetadataNames

Attributes
class TexMetadataNames(value)

Names for the metadata keys in the texture files

Gamma = 'gamma'

Adjusts the gamma value of the texture file


FileExt

Attributes
class FileExt(value)

Different file extensions for files

Buf = '.buf'

Buffer file extension

DDS = '.dds'

Direct Draw Surface file extension

Ini = '.ini'

Initialization file extension

Txt = '.txt'

Text file extension


FileTypes

class FileTypes(value)

Different types of files the software encounters

Blend = 'Blend.buf'

Blend.buf files

Default = 'file'

Default file type

Ini = '*.ini file'

Initialization files

Log = 'RemapFixLog.txt'

Log file

RemapBlend = 'RemapBlend.buf'

RemapBlend.buf files

RemapTexture = 'RemapTex.dds'

RemapTex.dds files

Texture = '*.dds'

Texture .dds files



Utilities

Some useful utility classes.


FileService

class FileService

Tools for handling with files and folders

classmethod absPathOfRelPath(dstPath: str, relFolder: str) str

Retrieves the absolute path of the relative path of a file with respect to a certain folder

Parameters:
  • dstPath (str) – The target file path we are working with

  • relFolder (str) – The folder that the target file path is relative to

Returns:

The absolute path for the target file

Return type:

str

classmethod changeExt(file: str, newExt: str) str

Changes the extension for a file

Parameters:
  • file (str) – The file path to the file we are working with

  • newExt (str) – The name of the new extension for the file (without the dot at front)

Returns:

the new file path with the extension changed

Return type:

str

classmethod copyFile(src: str, dest: str)

Copies a file from src to dest

Parameters:
  • src (str) – The file path to the file to be copied

  • dest (str) – The new file path for the copied file

classmethod disableFile(file: str, filePrefix: str = 'DISABLED_RemapBackup_') str

Marks a file as ‘DISABLED’ and changes the file to a .txt file

Parameters:
  • file (str) – The file path to the file we are working with

  • filePrefix (str) –

    Prefix name we want to add in front of the file name

    Default: “DISABLED_BossFixBackup_”

Returns:

The new name of the file

Return type:

str

classmethod getFiles(path: str | None = None, filters: List[Callable[[str], bool]] | None = None, files: List[str] | None = None) List[str] | List[List[str]]

Retrieves many different types of files within a folder

Note

Only retrieves files that are the direct children of the folder (will not retrieve files nested in a folder within the folder we are searching)

Parameters:
  • path (Optional[str]) –

    The path to the target folder we are working with. If this value is set to None, then will use the current directory of where this module is loaded

    Default: None

  • filters (Optional[List[Callable[[str], bool]]]) –

    Different filter functions for each type of file we are trying to get. If this values is either None or [], then will default to a filter to get all the files

    Default: None

  • files (Optional[List[str]]) –

    The files contained in the target folder

    If this value is set to None, then the function will search for the files

    Default: None

Returns:

The files partitioned into the different types specified by the filters

If ‘filters’ only has 1 element, then the function returns List[str] Otherwise, will return List[List[str]]

Return type:

Union[List[str], List[List[str]]]

classmethod getFilesAndDirs(path: str | None = None, recursive: bool = False) List[List[str]]

Retrieves the files and folders contained in a certain folder

Parameters:
  • path (Optional[str]) –

    The path to the target folder we are working with. If this argument is None, then will use the current directory of where this module is loaded

    Default: None

  • recursive (bool) –

    Whether to recursively check all the folders from our target folder

    Default: False

Returns:

The files and directories within the folder. The order for the result is:

  1. files

  2. folders

Return type:

[List[str], List[str]]

classmethod getRelPath(path: str, start: str) str

Tries to get the relative path of a file/folder relative to another folder, if possible.

If it is not possible to get the relative path, will return back the original file path

Note

An example where it would not be possible to get the relative path would be:

  • If the file is located in one mount (eg. C:/ drive) and the folder is located in another mount (eg. D:/ drive)

Parameters:
  • path (str) – The path to the target file/folder we are working with

  • start (str) – The path that the target file/folder is relative to

Returns:

Either the relative path or the original path if not possible to get the relative paths

Return type:

str

classmethod getSingleFiles(path: str | None = None, filters: Dict[str, Callable[[str], bool]] | None = None, files: List[str] | None = None, optional: bool = False) str | None | List[str] | List[str | None]

Retrieves exactly 1 of each type of file in a folder

Parameters:
  • path (Optional[str]) –

    The path to the target folder we are searching.

    If this value is set to None, then will use the current directory of where this module is loaded

    Default: None

  • filters (Optional[Dict[str, Callable[[str], bool]]]) –

    Different filter functions for each type of file we are trying to get. If this value is None or {}, then will default to use a filter to get all files

    The keys are the names for the file type

    Default: None

  • files (Optional[List[str]]) –

    The files contained in the target folder

    If this value is set to None, then the function will search for the files

    Default: None

  • optional (bool) –

    Whether we want to send an exception if there is not exactly 1 file for a certain type of file

    1. If this value is False and there are no files for a certain type of file, then will raise a MissingFileException

    2. If this value is False and there are more than 1 file for a certain type of file, then will raise a DuplicateFileException

    3. If this value is True and there are no files for a certain type of file, then the file for that type of file will be None

    4. If this value is True and there are more than 1 file for a certain type of file, then will retrieve the first file for that type of file

    Default: False

Raises:
  • MissingFileException – if optional is set to False and there are not files for a certain type of file

  • DuplicateFileException – if optional is set to False and there are more than 1 file for a certain type of file

Returns:

The files partitioned for each type of file

  • If filters only contains 1 element and optional is False, then will return str

  • If filters contains more than 1 element and optional is ``False`, then will return List[str]

  • If filters only contains 1 element and optional is True, then will return Optional[str]

  • Otherwise, returns List[Optional[str]]

Return type:

Union[Optional[str], List[str], List[Optional[str]]]

classmethod ntPathToPosix(path: str) str

Converts a file path from the ntpath library to a file path for the os library

Note

The character for the folder paths (/ or \) used in both libraries may be different depending on the OS

Parameters:

path (str) – The file path we are working that is generated from the ‘ntpath’ library

Returns:

The file path generated by the ‘os’ library

Return type:

str

classmethod parseOSPath(path: str)

Retrieves a normalized file path from a string

Parameters:

path (str) – The string containing some sort of file path

classmethod read(file: str, fileCode: str, postProcessor: Callable[[TextIoWrapper], Any]) Any

Tries to read a file using different file encodings

Will interact with the file using the following order of encodings:

  1. utf-8

  2. latin1

Parameters:
  • file (str) – The file we are trying to read from

  • fileCode (str) – What file mode to interact with the file (eg. r, rb, r+, etc…)

  • postProcessor (Callable[[TextIoWrapper], Any]) – A function used to process the file pointer of the opened file

Returns:

The result after processing the file pointer of the opened file

Return type:

Any

classmethod readBinary(src: str | bytes) bytes

Reads a binary file

Parameters:

src (Union[str, bytes]) – The source to read from

Returns:

The read bytes

Return type:

bytes

classmethod rename(oldFile: str, newFile: str)

Renames a file

Warning

If the new name for the file already exists, then the function deletes the file with the new name and renames the target file with the new name

Parameters:
  • oldFile (str) – file path to the target file we are working with

  • newFile (str) – new file path for the target file

classmethod writeBinary(file: str, data: bytes)

Writes data into a binary file

Parameters:
  • file (str) – The file to write into

  • data (bytes) – The data to write


DictTools

class DictTools

Tools for handling with Dictionaries

classmethod combine(dict1: Dict[Hashable, Any], dict2: Dict[Hashable, Any], combineDuplicate: Callable[[Any, Any], Any] | None = None) Dict[Hashable, Any]

Creates a new dictionary from combining 2 dictionaries

Parameters:
  • dict1 (Dict[Hashable, Any]) – The destination of where we want the combined dictionaries to be stored

  • dict2 (Dict[Hashable, Any]) – The dictionary we want to combine with

  • combineDuplicate (Optional[Callable[[Any, Any], Any]]) –

    Function for handling cases where there contains the same key in both dictionaries

    If this value is set to None, then will use the key from ‘dict2’

    Default: None

  • makeNewCopy (bool) – Whether we want the resultant dictionary to be newly created or to be updated into dict1

Returns:

The new combined dictionary

Return type:

Dict[Hashable, Any]

classmethod filter(dict: Dict[Hashable, Any], predicate: Callable[[Hashable, Any], bool]) Dict[Hashable, Any]

Filters a dictionary

Parameters:
  • dict (Dict[Hashable, Hashable]) – The dictionary to filter

  • predicate (Callable[[Hashable, Any], bool]) –

    The predicate used for the filter

    The predicate has the following parameters

    1. The key of the dictionary

    2. The value of the dictionary

Returns:

The filtered dictionary

Return type:

Dict[Hashable, Any]

classmethod forDict(nestedDict: Dict[Hashable, Any], keyNames: List[str], func: Callable[[Dict[str, Hashable], Dict[str, Any]], Any])

Iterates over a nested dictionary

Parameters:
  • nestedDict (Dict[Hashable, Any]) – The nested dictionary to iterate over

  • keyNames (List[str]) – The variable names of the keys in the nested dictionary

  • func (Callable[Dict[str, Hashable], Dict[str, Any], Any]) –

    callback function that will be called at the leaf node of the nested dictionary

    The function contains the following arguments: #. The dictionary keys encountered in the current iteration #. The corresponding values encountered at each dictionary layer in the current iteration

classmethod getFirstKey(dict: Dict[Any, Any]) Any

Retrieves the first key in a dictionary

Parameters:

dict (Dict[Any, Any]) –

The dictionary we are working with

Note

The dictionary must not be empty

Returns:

The first key of the dictionary

Return type:

Any

classmethod getFirstValue(dict: Dict[Any, Any]) Any

Retrieves the first value in a dictionary

Parameters:

dict (Dict[Any, Any]) – The dictionary we are working with

Returns:

The first value of the dictionary

Return type:

Any

classmethod invert(dict: Dict[Hashable, Hashable]) Dict[Hashable, Hashable]

Inverts a dictionary by making the keys the values and the values the keys

Parameters:

dict (Dict[Hashable, Hashable]) – The dictionary to invert

Returns:

The inverted dictionary

Return type:

Dict[Hashable, Hashable]

classmethod update(srcDict: Dict[Hashable, Any], newDict: Dict[Hashable, Any], combineDuplicate: Callable[[Any, Any], Any] | None = None) Dict[Hashable, Any]

Updates srcDict based off the new values from newDict

Parameters:
  • srcDict (Dict[Hashable, Any]) – The dictionary to be updated

  • newDict (Dict[Hashable, Any]) – The dictionary to help with updating srcDict

  • combineDuplicate (Optional[Callable[[Any, Any], Any]]) –

    Function for handling cases where there contains the same key in both dictionaries

    • The first parameter comes from srcDict

    • The second parameter comes from newDict

    If this value is set to None, then will use the key from newDict

    Default: None

Returns:

Reference to the updated dictionary

Return type:

Dict[Hashable, Any]


TextTools

class TextTools
classmethod capitalize(txt: str) str

Capitalize only the beginning letter of ‘txt’

Parameters:

txt (str) – The text to be capitalized

Returns:

The new text with its first letter capitalized

Return type:

str

classmethod getTextLines(txt: str) List[str]

Retrieves the lines of text, split by the newline character, similar to how python’s readlines function works

Parameters:

txt (str) – The target text to be split

Returns:

The lines of text that were split

Return type:

List[str]

classmethod removeLines(txtLines: List[str], partIndices: List[Tuple[int, int]]) List[str]

Removes multiple sub-lists of lines from a list of text lines

Parameters:
  • txtLines (List[str]) – The lines of text to have its lines removed

  • partIndices (List[Tuple[int, int]]) –

    The indices for the list of lines to be removed

    The tuples contain the following data:

    1. The start index for the list of lines

    2. The ending index for the list of lines

Returns:

The new lines of text with the removed lines

Return type:

List[str]

classmethod removeParts(txt: str, partIndices: List[Tuple[int, int]]) str

Remove multiple substrings from a text based off the indices of the substrings

Parameters:
  • txt (str) – The target txt to have the substrings removed

  • partIndices (List[Tuple[int, int]]) –

    The indices for the substrings to be removed

    The tuples contain the following data:

    1. The start index for the substring

    2. The ending index for the substring

Returns:

The new string with the substrings removed

Return type:

str


FilePath

Attributes
class FilePath(path: str)

Class for storing info about a file path

Parameters:

path (str) – The file path

property base

The base for the file path (includes file extension)

Getter:

Retrieves the base

Setter:

Sets the new base for the file path

Type:

str

property baseName

The basename for the file path without any file extensions

Getter:

Retrieves the basename

Setter:

Sets the new basename for the file path

Type:

str

property folder

The parent folder for the path

Getter:

Retrieves the parent folder name

Setter:

Sets the new parent folder name

Type:

str

property path

The file path

Getter:

Retrieves the path

Setter:

Sets a new path

Type:

str


Cache

Attributes
Methods
class Cache(capacity: int = 128, cacheStorage: Any | None = None)

Class for a generic cache

Supported Operations:

len(x)

Retrieves the size of the Cache, x

x[key]

Retrieves the value from the Cache, x, from the key key

x[key] = newValue

Sets the key key of the Cache, x, to have the value of newValue


Parameters:
  • capacity (int) –

    The maximum capacity of the cache

    Default: 128

  • cacheStorage (Optional[Any]) –

    The type of KVP (Key-value pair) data structure to use for the cache. If this parameter is None, then will use a dictionary

    Default: None

capacity

The maximum capacity of the cache

Type:

int

cacheStorage

The type of KVP (Key-value pair) data structure to use for the cache.

Type:

Any

clear() None

Clears the cache


LruCache

Methods
class LruCache(capacity: int = 128)

This class inherits from Cache

Class for an LRU cache

Supported Operations:

len(x)

Retrieves the size of the LruCache, x

x[key]

Retrieves the value from the LruCache, x, from the key key

x[key] = newValue

Sets the key key of the LruCache, x, to have the value of newValue


Parameters:

capacity (int) –

The maximum capacity of the cache

Default: 128

clear() None

Clears the cache


Algo

class Algo

Tools for some basic algorithms

classmethod binaryInsert(lst: List[T], target: T, compare: Callable[[T, T], bool], optionalInsert: bool = False) bool

Insert’s ‘target’ into ‘lst’ using binary search

Parameters:
  • lst (List[T]) – The sorted list we want to insert the target element

  • target (T) – The target element to insert

  • compare (Callable[[T, T], bool]) – The compare function for comparing elements in the list with the target element

  • optionalInsert (bool) –

    Whether to still insert the target element into the list if the element target element is found in the list

    Default: False

Returns:

Whether the target element has been inserted into the list

Return type:

bool

classmethod binarySearch(lst: List[T], target: T, compare: Callable[[T, T], bool]) List[int | bool]

Performs binary search to search for ‘target’ in ‘lst’

Parameters:
  • lst (List[T]) – The sorted list we are searching from

  • target (T) – The target element to search for in the list

  • compare (Callable[[T, T], bool]) – The compare function for comparing elements in the list with the target element

Returns:

  • The first element is whether the target element is found in the list

  • The second element is the found index or the index that we expect the target element to be in the list

Return type:

[int, bool]


Builder

Attributes
Methods
class Builder(cls: Type[BuildCls], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)

Class to dynamically create a new object

Parameters:
  • cls (Type[T]) – The class for the objects to be built from

  • args (Optional[List[Any]]) –

    The constant arguments used to build the object

    Default: None

  • kwargs (Optional[Dict[str, Any]]) –

    The constant keyword arguments used to build the object

    Default: None

cls

The class for the objects to be built from

Type:

Type[T]

args

The constant arguments used to build the object

Type:

List[Any]

kwargs

The constant keyword arguments used to build the object

Type:

Dict[str, Any]

build(*args, **kwargs) BuildCls

Builds the object

Parameters:
  • *args – arguments to build the object

  • **kwargs – keyword arguments to build the object

Returns:

The built objects

Return type:

T


FlyweightBuilder

Methods
class FlyweightBuilder(cls: Type[BuildCls], args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None)

This class inherits from Builder

A flyweight factory for building the same reusable objects (based off flyweight design pattern)

build(args: List[Any] | None = None, kwargs: Dict[str, Any] | None = None, id: Hashable | None = None, cache: bool = True) BuildCls

Builds the object

Parameters:
  • args (Optional[List[Any]]) –

    arguments to build the object

    Default: None

  • kwargs (Optional[Dict[str, Any]]) –

    keyword arguments to build the object

    Default: None

  • id (Optional[Hashable]) –

    The id for the repeating states to be built by the object

    If this value is None, then will auto-generate an id

    Default: None

  • cache (bool) –

    Whether to cache the built object

    Note

    If this value is set to False, then this function behaves the same as Builder.build()

    Default: True

Returns:

The built objects

Return type:

T



Exceptions


Error

class Error(message: str)

The base exception used by this module

Parameters:

message (str) – the error message to print out


FileException

Attributes
class FileException(message: str, path: str | None = None)

This Class inherits from Error

Exceptions relating to files

Parameters:
  • message (str) – The error message to print out

  • path (Optional[str]) –

    The path where the error for the file occured. If this value is None, then the path will be the current directory where this module is loaded

    Default: None

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


DuplicateFileException

class DuplicateFileException(files: List[str], fileType: str = 'file', path: str | None = None)

This Class inherits from FileException

Exception when there are multiple files of the same type in a folder

Parameters:
  • files (List[str]) – The files that triggered the exception

  • fileType (str) –

    The name for the type of files

    Default: “file”

  • path (Optional[str]) –

    The path to the folder where the files are located If this value is None, then the path will be the current directory where this module is loaded

    Default: None

files

The files that triggered the exception

Type:

List[str]

fileType

The name for the type of files

Default: None

Type:

str

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


MissingFileException

class MissingFileException(fileType: str = 'file', path: str | None = None)

This Class inherits from FileException

Exception when a certain type of file is missing from a folder

Parameters:
  • fileType (str) –

    The type of file searching in the folder

    Default: “file”

  • path (str) –

    The path to the folder that is being searched. If this value is None, then the path will be the current directory where this module is loaded

    Default: None

fileType

The type of file searching in the folder

Type:

str

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


RemapMissingBlendFile

Attributes
class RemapMissingBlendFile(remapBlend: str)

This Class inherits from FileException

Exception when a RemapBlend.buf file is missing its corresponding Blend.buf file

Parameters:

remapBlend (str) – The path to the RemapBlend.buf file

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


BlendFileNotRecognized

Attributes
class BlendFileNotRecognized(blendFile: str)

This Class inherits from FileException

Exception when a Blend.buf file cannot be read

Parameters:

blendFile (str) – The file path to the Blend.buf file

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


BadBlendData

Attributes
class BadBlendData

This Class inherits fsrom Error

Exception when certain bytes do not correspond to the format defined for a Blend.buf file

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


ConflictingOptions

Attributes
class ConflictingOptions(options: List[str])

This Class inherits from Error

Exception when the script or RemapService is ran with options that cannot be used together

Parameters:

options (List[str]) – The options that cannot be used together

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


InvalidModType

Attributes
class InvalidModType(type: str)

This Class inherits from Error

Exception when the type of mod specified to fix is not found

Parameters:

type (str) – The name for the type of mod specified

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.


NoModType

Attributes
class NoModType

This Class inherits from Error

Exception when trying to fix a mod of some unidentified mod type

Parameters:

type (str) – The name for the type of mod specified

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.