GMWare.M2 1.1.3

dotnet add package GMWare.M2 --version 1.1.3                
NuGet\Install-Package GMWare.M2 -Version 1.1.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GMWare.M2" Version="1.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GMWare.M2 --version 1.1.3                
#r "nuget: GMWare.M2, 1.1.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GMWare.M2 as a Cake Addin
#addin nuget:?package=GMWare.M2&version=1.1.3

// Install GMWare.M2 as a Cake Tool
#tool nuget:?package=GMWare.M2&version=1.1.3                

GMWare.M2

Nuget

This library is designed to manipulate files in formats created by M2 Co., Ltd. This includes the PSB format, .m (MArchive) format, and archive files (e.g. alldata.bin). These files can be found in games using M2's E-mote SDK and products using M2's emulation frontend m2engage.

Supported formats

  • PSB: PSB is a binary serialization of JSON-like data, used extensively in E-mote motion files and other resources and configuration files in m2engage. Classes for manipulating PSB files are in GMWare.M2.Psb. Primarily, PsbReader and PsbWriter are used for deserializing and serializing between PSB and JSON.NET's JTokens. PSB filtering is supported, and an implementation of the default filter used for E-mote is included.
  • MArchive: These are compression/encryption wrappers with file extension .m. Classes for manipulating them are in GMWare.M2.MArchive. Codecs for mdf (DEFLATE), mzs (ZStandard), and mfl (FastLZ) are included.
  • PSB archive resource: Commonly known as alldata.bin, the corresponding PSB file serves as a manifest while the .bin file itself contains all the data. The class for manipulating these files is GMWare.M2.MArchive.AllDataPacker.

This library does not offer specific abstractions for manipulating E-mote motion files. If you are looking for that, try FreeMote.

Compatibility

The PSB serializer attempts to create files that are as close in specifications to original PSB files created by M2's SDKs as possible. All currently known versions of PSB files (v1 to v4) can be serialized/deserialized. Generated PSB name tables are created with tight packing, and PSB optimization is supported. JSON.NET is used for convenience for converting deserialized PSBs to object instances and vice versa.

Examples

PSB Deserialization

using (FileStream fs = File.OpenRead(psbPath))
using (PsbReader psbReader = new PsbReader(fs))
{
    JToken root = psbReader.Root;

    // Do what you need with root here
}

Accessing PsbReader.Root will load the content from the PSB file.

By default lazy stream loading is enabled. If you need access to streams within the PSB but want to dispose the reader before that, make sure to call PsbReader.LoadAllStreamData() before you dispose.

PSB Serialization

using (Stream fs = File.Create(psbPath))
{
    // root: The JToken you want to serialize
    // streamSource: The stream source, if you have JStreams that don't have
    //               their data loaded
    PsbWriter psbWriter = new PsbWriter(root, streamSource) {
        Version = 4
    };
    psbWriter.Write(fs);
}

Set version, flags, and whether to optimize before you call PsbWriter.Write().

MArchive

var packer = new MArchivePacker(new ZlibCodec(), keyString, 64);
if (File.Exists(path))
{
    packer.CompressFile(path);
}
else
{
    packer.CompressDirectory(path);
}

The opposite functions MArchivePacker.DecompressFile() and MArchivePacker.DecompressDirectory() work the same way. Each of these functions take keepOrig. The .m or decompressed file will be deleted if set to false. Set to true to keep the source file. MArchivePacker.CompressDirectory() has additionally a forceCompress argument. By default there's a list of folder names where the files inside will not be compressed. Set to true to force compression.

PSB Archive resource

var packer = new MArchivePacker(new ZlibCodec(), keyString, 64);
AllDataPacker.UnpackFiles(archPath, extractPath, packer);
AllDataPacker.Build(folderPath, outPath, packer);

For AllDataPacker.UnpackFiles(), you can supply either the .bin, .psb, or the .psb.m file as the input path. For AllDataPacker.Build(), do not include .bin, .psb, or .psb.m in the output path.

Supplying a MArchivePacker is optional. It is used to pack the .psb manifest into a .m file.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on GMWare.M2:

Repository Stars
stuff-by-3-random-dudes/UWUVCI-AIO-WPF
Version Downloads Last updated
1.1.3 483 10/30/2022
1.1.2 599 6/26/2020
1.1.1 426 6/26/2020
1.1.0 445 6/25/2020
1.0.3 452 4/15/2020
1.0.2 639 1/5/2020
1.0.1 571 12/31/2019
1.0.0 548 12/31/2019

- Fix alldata parsing to allow files >4GB
- Fix PSB long parsing