PMP Protobuf is a helper library for the PMP (PenguinMod Project) format and its protobuf counterpart, which is used in the PenguinMod backend.
Use NPM:
npm install pmp-protobuf
import { jsonToProtobuf } from "pmp-protobuf';
const json = /* get the project.json from somewhere... */;
// this will be a Uint8Array
const protobuf = jsonToProtobuf(json);
import { protobufToJson } from "pmp-protobuf';
const protobuf = /* get the protobuf from somewhere (probably the API)... */;
// this will be an object
const json = protobufToJson(protobuf);
import { protobufToPMP } from "pmp-protobuf';
const protobuf = /* get the protobuf from somewhere (probably the API)... */;
const assets = /* get these from somewhere (probably also the API)... */;
// this will be in the PMP format; it will be an ArrayBuffer.
const pmp = await protobufToPMP(protobuf, assets);
import { jsonToPMP } from "pmp-protobuf';
const json = /* get the json from somewhere (probably the VM)... */;
const assets = /* get these from somewhere (probably also the VM)... */;
// this will be in the PMP format; it will be an ArrayBuffer.
const pmp = await jsonToPMP(protobuf, assets);
You install pbjs... somehow... tbh I don't remember... It's been a while.
pbjs -t json --keep-case path/to/protobufs/project.proto path/to/protobufs/sprite.proto > dest/bundle.json