Skip to content

About

A GamedataLib so you can handle .sav files from Tomodachi Life: Living the Dream and The Legend of Zelda: Tears of the Kingdom

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

gamedatalib

A library for parsing and editing Nintendo gamedata binary save files

Install

npm i gamedatalib

How to for dummies

import fs from "node:fs";
import { GameData, hash } from "gamedatalib";

const file = fs.readFileSync("mii.sav");
const data = file.buffer.slice(file.byteOffset, file.byteOffset + file.byteLength);
const save = GameData.fromArrayBuffer(data);

const miiNameSection = save.WString32Array[hash("Mii.Name.Name")];
miiNameSection.setValueAt(0, "Blah")

const dataOut = GameData.toArrayBuffer(save);
fs.writeFileSync("miiOut.sav", Buffer.from(dataOut));

Creating a new file from scratch

Start with a new GameData instance, add entries via addNew, then serialize with toArrayBuffer.

import fs from "node:fs";
import { GameData, hash } from "gamedatalib";

const save = new GameData();

save.Int.addNew(hash("Player.Level"), 42);
save.BoolArray.addNew(hash("Player.Flags"), [true, false, true]);
save.WString32.addNew(hash("Player.Name"), "Alex");

const out = GameData.toArrayBuffer(save);
fs.writeFileSync("new.sav", Buffer.from(out));

Struct entries

// scalar
const enabled = save.Int[hash("Field.Scalar")];
enabled.setValue(1);

// array
const names = save.WString32Array[hash("Field.Array")];
names.setValueAt(0, "Name")

Hash keys

Entries are keyed by MurmurHash3 32-bit of the original field name.

const key = hash("Key.Name"); // 0xAA79FCCC
const entry = save.WString32Array[key];

About

A GamedataLib so you can handle .sav files from Tomodachi Life: Living the Dream and The Legend of Zelda: Tears of the Kingdom

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages