Coder Social home page Coder Social logo

LibSWBF2

C++ Library handling files from Star Wars Battlefront 2 (2005) and the Mod Tools.
still developing. Looking for participants.

Join us on Discord

This library is capable of reading various proprietary file formats from the old Star Wars Battlefront 2 game, focusing primarily on munged file formats, and providing desired data (models, textures, terrain, sounds, etc...) to the user in a high level, easy to use manner.
From how this library is implemented on a low level, altering any value, or even creating a munged file from scratch is technically possible, although at this point write serializers are not implemented yet.

Examples

How to grab the image data of a single texture (no nullptr/success checks applied here for more readability)

using LibSWBF2::Wrappers::Level;
using LibSWBF2::Wrappers::Texture;
using LibSWBF2::ETextureFormat;

Level* lvl = Level::FromFile("geo1.lvl");
const Texture* texture = lvl->GetTexture("geo_main_1");

uint16_t width, height;
const uint8_t* data;

// param 1: Desired format you want the image data to be in. 
//          Resulting data is always uncompressed. 
//          The lib handles decompression and conversion, if necessary
// param 2: Mip map index. Use 0 to always get the highest available resolution.
texture->GetImageData(ETextureFormat::B8_G8_R8_A8, 0, width, height, data);

// ... now, do what you want with the image data. copy, export, whatever.

Level::Destroy(lvl);

Note that the data pointer will get invalid once the Level instance is destroyed.

Everything else is handled in a similar manner. An overview of available calls:

GetModels()
GetTextures()
GetWorlds()
GetTerrains()
GetScripts()
GetSounds()

GetModel(String modelName)
GetTexture(String textureName)
GetWorld(String worldName)
GetTerrain(String terrainName)
GetScript(String scriptName)
GetSound(String soundName)

Supported file formats

  • MSH
  • LVL
  • BNK
  • ZAFBIN
  • ZAABIN

Build

This project uses CMake

libswbf2's Projects

libswbf2 icon libswbf2

Library handling files from Star Wars Battlefront 2 (2005) and the Mod Tools

lvlexplorer icon lvlexplorer

Explore Star Wars Battlefront 2 (2005) *.lvl game data files.

swbf2phoenix icon swbf2phoenix

A re-implementation of the old Star Wars Battlefront II (2005) game, utilizing the Unity game engine

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.