Giter Site home page Giter Site logo

xfbin_lib's Introduction

xfbin_lib

A python module (and script) for parsing CyberConnect2 games XFBIN files.

Installation

For using as a script for unpacking XFBIN files, download the latest release.

For using as a module for another project, just add it as a submodule and import the following:

from xfbin_lib.xfbin import *

Script Usage

usage: xfbin_parser.exe [-h] [-f] [-d] [-s] [-j] [-v] [input] [output]

Unpacks/Repacks nuccChunks from CyberConnect2 XFBIN container files.

positional arguments:
  input                 path to input XFBIN file OR path to folder to repack
  output                path to output folder to extract the chunks to (defaults to a new folder with the name of the
                        input XFBIN) OR path to output XFBIN file when repacking (defaults to folder name + ".xfbin")

optional arguments:
  -h, --help            show this help message and exit
  -f, --force-overwrite
                        overwrite old extracted files without prompting
  -d, --file-data-only  when possible, write each chunk's file data only (NTP3 for .nut, NDP3 for .nud) (will disable repacking)
  -s, --sort-types      sort nuccChunks by type instead of page (will disable repacking)
  -j, --no-json         do not write "_page.json" for extracted pages (will disable repacking)
  -v, --verbose         print info about each extracted chunk

Module Usage

Reading XFBIN files

# Using path to file
xfbin_obj = read_xfbin(path)

# Using a bytearray object
xfbin_obj = read_xfbin(buffer)

Accessing NuccChunk objects inside an Xfbin

# Each Xfbin contains Page objects, which contain NuccChunk objects
for page in xfbin_obj.pages:
    for chunk in page.chunks:
        # Do stuff with each NuccChunk
        print(f'Chunk name: {chunk.name}')
        print(f'Chunk path: {chunk.filePath}')
        print(f'Chunk type: {NuccChunk.get_nucc_str_from_type(type(chunk)})')

Writing XFBIN files from an Xfbin object

# Writes the Xfbin to a bytearray buffer
buffer = write_xfbin(xfbin_obj)

# Writes the Xfbin to a path
write_xfbin_to_path(xfbin_obj, path)

There is no real documentation for all supported nuccChunk types, so if you want to use the module for accessing/modifying NuccChunk objects, I suggest checking nucc.py, which contains the current implementation for all NuccChunk objects. The properties added inside each init_data method are the same properties you can access from a NuccChunk object.

Credits

Smash Forge team for their NUD models and NUT textures implementation, which the NuccChunkModel and NuccChunkTexture classes use, respectively.

xfbin_lib's People

Contributors

mosamadeeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

maxcabd hengle

xfbin_lib's Issues

Bug? - Can't extract "1efcmn.xfbin" file

For some reason, it's not possible to extract this file. I'm guessing is because it's quite a large .xfbin compared to the others?
I'm using the compiled .exe that is available in the releases tab.

image

Here's a picture of the error and the .xfbin.

1efcmn.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.