Skip to content

Lekuruu/xnb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XNB

A python tool for reading xnb files.

At this point it can only deserialize Texture2DReader files with the BGRA surface format, but the project should allow for extension of the reader classes. I mostly used this code as a reference for it.

Installation & Usage

python -m pip install git+https://github.com/Lekuruu/xnb.git

Using the cli

python -m xnb <INPUT> <OUTPUT>

Usage of the reader class

from xnb import XNBReader
import logging

# Initialize the class from a filepath
reader = XNBReader.from_file('./your_file.xnb')

# Initialize the class from bytes
reader = XNBReader(b'...')

# When initializing the class, it will already try
# to automatically deserialize the file. You can
# turn on logging to view the process in detail.
logging.basicConfig(level=logging.INFO)

# Access the deserialized content for each reader
for content in reader.contents:
    print(content)

# Save the xnb data into a readable file
reader.save('./your_output')