Skip to main content

Python library for parsing binary files from Halo Infinite.

Project description

libpyinfinite

latest

LibPyInfinite is a typed python library for parsing Halo Infinite binary files. It implements a module and tag reader that can be used indepently or in conjunction.

Installation

Libpyinfinite is available on pypi.

pip install libpyinfinite

Example Usage

Reading a module instance:

from libpyinfinite.module.module import HiModule

def read_module():
    with open(modulepath, "rb") as file:
        module_instance = HiModule()
        module_instance.read(file)

Creating a Oodle Decompressor:

Oodle is a decompression library used to pack module files, requiring DLL calls to oo2core_8_win64.dll. This is achieved by either directly specifying the DLL or in Linux systems, using linoodle.

from libpyinfinite.module.oodle.oodleDecompressor import OodleDecompressor

decompressor = OodleDecompressor("./oo2core_8_win64.dll") # Windows 64-Bit
decompressor = OodleDecompressor("./linoodle.so") # Linux/Linux-like. (Requires DLL to be in the same directory.)

Reading the third tag from a module instance:

from libpyinfinite.tag.tag import HiTag

# File handle of module, index of tag, decompressor
tagData = moduleInstance.read_tag(file, 3, decompressor)
tagInstance = HiTag()
tagInstance.read(tagData)

Accessing values from a tag:

print(tagInstance.Header.magic)

>>> "ucsh"

for ref in tagInstance.Dependencies:
    print(f"Tag Reference: {ref.globalId}")

>>> "Tag Reference: 0xFFFFFFF"
>>> "Tag Reference: 0x0A00000"

Using defined tag structures

# Reading "RUCY" tag
from libpyinfinite.tag.definitions.rucy import RuntimeCoatingStyleTag

rucy = RuntimeCoatingStyleTag()
rucy.read(tagData)

# What's the emissive intensity of this tag?
print(rucy.info.emissiveIntensity)

>>> 0.00

Credits

  • MontagueM for OodleDecompressor
  • Gamergotten for TagFramework
  • Coreforge for libinfinite
  • Z-15 for HITE
  • Urium86 for pyhirtlib and LibHIRT
  • Shockfire for Ausardocs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libpyinfinite-0.0.2.tar.gz (37.1 kB view hashes)

Uploaded Source

Built Distribution

libpyinfinite-0.0.2-py3-none-any.whl (44.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page