Skip to content

ObjectTranslator doesn't perfectly roundtrip w3a files #81

Description

@Slayer95

Test script:

"use strict";

const fs = require('fs');
const {ObjectsTranslator} = require('wc3maptranslator');

function parseAbilities(filePath) {
  return ObjectsTranslator.warToJson('abilities', fs.readFileSync(filePath));
}

function exportAbilities(filePath, data) {
  fs.writeFileSync(filePath, ObjectsTranslator.jsonToWar('abilities', data).buffer);
}

const abilities = parseAbilities('war3map.w3a');
if (abilities.errors.length) throw new Error(`Errors found: ${abilities.errors.join(', ')}`)
exportAbilities('war3map-rt.w3a', abilities.json);

In the attached files, you can verify that war3map-rt.w3a has added a bunch of extraneous FourCC codes where there used to be a quad of zeroes.

w3a-test.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions