npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

madden-file-tools

v2.7.4

Published

A set of APIs to read Madden files, including archives.

Downloads

14

Readme

madden-file-tools

JS API for reading and extracting EA/Madden files.

Usage

This package is useful for parsing the following files:

  • TDB files: used by legacy Madden, NCAA, and Head Coach games. (Can Read and write)
  • AST files: used by many games. (Note: Read only as of now)
    • Contain other resource files such as DDS files.

EA TDB Files (Legacy Madden, NCAA 14)

const TDBHelper = require('madden-file-tools/helpers/TDBHelper');
const tdbPath = [path to file];

const helper = new TDBHelper();
helper.load(tdbPath)
    .then((file) => {
        // You have access to all the tables here.
        
        // Access individual table
        const awplTable = file.AWPL;
            // Alternative: file.tables[0];
            // `tables` is just an array.

        // To get access to the records, you need to read them in by each table. Tables are not automatically read due to memory constraints.
        file.AWPL.readRecords()
            .then(() => {
                // Here you have access to all the AWPL records and data.
                
                // Access field values
                const firstStc1Field = file.AWPL.records[0].fields['STC1'].value;
                    // Or file.AWPL.records[0].fields.STC1.value;

                    // Alternative: file.AWPL.records[0].STC1;
                    // The alternative is nicer to use, but less performant.


                // Set field values
                file.AWPL.records[0].fields['STC1'].value = 20;

                    // Alternative: file.AWPL.records[0].STC1 = 20;
                    // Again, this way is a little slower, but is nicer to write.

                // Save the file
                helper.save([optional new file here, otherwise overwrite])
                    .then(() => {
                        // File has been saved here.
                    });
            });
    });

Read HC09 Files

The Head Coach 09 save is a little different from the others. It does not contain the DB file at the very beginning, so I've included a nice helper to load and save.

const HeadCoach09Helper = require('madden-file-tools/helpers/HeadCoach09Helper');
const headCoachSaveFilePath = [path to file];

const helper = new HeadCoach09Helper();
helper.load(headCoachSaveFilePath)
    .then((file) => {
        // Same TDB file API as above. You have access to all the tables here.

        // Make changes here

        // Save the file
        helper.save([optional new file here, otherwise overwrite])
            .then(() => {
                // File has been saved here.
            });
    });

Generic TDB Reader/Writer Usage

const fs = require('fs');
const TDBParser = require('madden-file-tools/streams/TDBParser');
const TDBWriter = require('madden-file-tools/streams/TDBWriter');

const parser = new TDBParser();
const readStream = fs.createReadStream([file path here]);

stream.on('end', function () {
    const file = parser.file;

    // Make changes here

    // Save
    const writeStream = fs.createWriteStream([path to write]);
    const writer = new TDBWriter(file);

    writeStream.on('end', () => {
        // File has been saved here.
    });

    writer
        .pipe(writeStream);
});

stream
    .pipe(parser);