MiSide: Zero
Install with App

Details

Latest version
2.4.0
Last Updated
First Uploaded
Downloads
3
Likes
0
Size
419KB
Dependants

Categories

VoidLib2

Modding library containing various utilites for modding Miside Zero.

Downloads Latest Release

Features:

  • gltf importer (through vgltf)
  • audio importer (through naudio/bass)
  • Game settings helper
  • Dynamic menu editor (wip)
  • Other utilities I find useful

Documentation

Presented by class name.

[!WARNING] Anything not documented in here may be subject to change! Do not rely on VoidLib2's undocumented apis!

AudioImporter

It contains two nested classes: NAudio and Bass. Use the one you want based on which dependencies are present. I prefer Bass though.

NAudio

You will need NAudio.dll, NAudio.Core.dll, NAudio.Wasapi.dll, and NAudio.WinMM.dll present in UserLibs in order to load audio using NAudio.

AudioClip Load(string filePath)
  • Throws FileNotFoundException if the file is not found
  • Otherwise, assuming some mysterious NAudio error doesn't happen, returns the loaded AudioClip
AudioClip Load(Stream stream, AudioFileFormat format, string name = "AudioClip")
  • Reads audio from the supplied stream.
  • Throws if the format is not supported (mainly if you casted an int not defined in AudioFileFormat)

AudioFileFormat:

public enum AudioFileFormat
{
     Wav,
     Mp3,
     Aiff
}

NAudio technically supports more, but they require extra libraries and I don't feel like handling that now.

Bass

The Bass audio importer is much more robust than the NAudio one, mainly since Bass is just better.

Bass will be automatically initialized in a static constructor (which runs just before any of it's methods are used for the first time). You do not need to initialize Bass yourself.

AudioClip LoadAudio(string filePath)
  • Throws FileNotFoundException file is not found
  • If a bass error occurs, throws BassException
int TryLoadAudio(string filePath, out AudioClip? clip)
  • Throws FileNotFoundException if the file is not found
  • Returns the error code. A nonzero error code indicates faliure.
  • clip is the loaded AudioClip. If a bass error occurs, clip is null. Otherwise, never null.
bool TryLoadAudio(string filePath, out AudioClip? clip, out int code)
  • Throws FileNotFoundException if the file is not found
  • Returns true if the import was sucessful; otherwise, false.
  • clip is the loaded AudioClip. If a bass error occurs, clip is null. Otherwise, never null, indicated by NotNullWhenAttribute (meaning you won't have to null check it or bang it)
  • code is the bass error code. Again, a nonzero error code indicates faliure. You can discard this if you don't care for it, but it's reccomended to do something with it.

There are also overloads for loading audio from Streams. Use them as needed, Bass will automatically detect the format since it's awesome.

BassException

An exception repersenting a Bass faliure.

int ErrorCode { get; }

The bass error code, for you to inspect it. eg '41'

public string ErrorName { get; }

The error name, eg 'BASS_ERROR_FILEFORM'

public string ErrorDescription { get; }

The error description, eg 'Unsupported file format'

It also calls the base constructor with a human readable message. A message looks something like this:

BASS_ERROR_FILEFORM (41): Unsupported file format

You can turn an error code into a name yourself using NativeBass.GetErrorName(int errorCode), and into a description using NativeBass.GetErrorMessage(int errorCode).

DynamicMenuEditor

public static bool AddMenuButton(
    float posY, 
    ButtonType buttonType, 
    string buttonText, 
    string name, 
    out GameObject? resultObject)

Adds a new menu button to the dynamic menu (not the main menu)

Parameters:

  • float posY: The Y position (in the menu's plane) of the button to be created.
  • DynamicMenuEditor.ButtonType buttonType: Which kind of button will be created.
  • string buttonText: The text the button will display.
  • string name: The name of the GameObject (button) that will be created.
  • out GameObject? resultObject: The resulting GameObject.

Returns false if it cannot find the loaded Return, Menu, and Resume buttons (including inactive ones), or if the selected template lacks a RectTransform or a supported text component. Otherwise returns true and sets resultObject to the new button. Throws ArgumentOutOfRangeException for an invalid ButtonType.

AddMenuGroup(), AddMenuSlider(), and AddMenuCheckbox() are planned.

ExitDoor

public static bool SetCollison(bool state)

Sets whether the BoxColliders on the ExitDoor and it's related interactables should be enabled.

Returns false if it is unable to find one or more of these GameObjects:

  • "World/House/Doors/ExitFrame/ExitDoor"
  • "World/Game/Acts/Hello Mita/Interactables 1/I Exit Door 1 " (that space at the end isnt a typo thats actually what its called)
  • "World/Game/Acts/Quality Time/Interactables 2/I ExitDoor 2"
public static bool SetEnabled(bool state)

Does NOT disable the GameObject, since that can cause issues. Sets whether the collision should be enabled and if its MeshRenderer is enabled, disabling it for all practical purposes.

Extensions

[!WARNING] This class is going to be moved to a new namespace soon

public static GameObject FindFirstChild(this GameObject g, string name)

Finds a direct child of the given GameObject by name, or follows a relative child path. Throws NullReferenceException if no matching child exists.

GltfImporter

public static GameObject LoadGlb(string path, string? name = null)

Loads a .glb file and builds a Unity GameObject hierarchy.

  1. Checks file exists (otherwise throws FileNotFoundException)
  2. Parses GLB via VGltf.GltfContainer
  3. Builds the parent-child hierarchy. Node translation, rotation, and scale are not applied.

Gltf will be supported soon since it's only a few code changes


Helper methods it uses

public static void BuildNode(GltfContainer container, int nodeIndex, Transform parent)

Builds a GLTF node into a Unity GameObject.


public static (UnityEngine.Mesh, int?) BuildMesh(GltfContainer container, int meshIndex)

Converts the first primitive of a GLTF mesh into a Unity Mesh.

Returns: (Mesh, materialIndex?)


public static Texture2D? LoadTexture(GltfContainer container, int materialIndex)

Extracts base color texture from material.


public static Vector3[] ReadVec3Array(GltfContainer container, int accessorIndex)

Reads float3 vertex data from buffer. Flips X axis for Unity space


public static Vector2[] ReadVec2Array(GltfContainer container, int accessorIndex)

Reads UV data. Flips V coordinate to match Unity


public static int[] ReadIntArray(GltfContainer container, int accessorIndex)

Reads triangle indices.


Music

Contains one method:

public static bool SetMusicMuted(bool muted)

Tries to find this GameObject:
"World/Ambience/Ambient Music"

And set it's AudioSource mute property to muted.

Useful if you want to mute the music for a bit without touching settings.

NativeBass

P/Invoke methods for using bass.dll. Check the bass documentation for how to use it

Settings

A wrapper class for getting and setting the game settings listed below without applying every setting at once.

MasterVolume

Gets or sets the global audio volume (0–1).
Updates the audio mixer master channel.


MusicVolume

Gets or sets the music volume (0–1).
Applies gain to the Music mixer group.


SFXVolume

Gets or sets the sound effects volume (0–1).
Applies gain to the SFX mixer group.


VocalVolume

Gets or sets the voice/dialogue volume (0–1).
Applies gain to the Vocals mixer group.


AmbienceVolume

Gets or sets the ambient audio volume (0–1).
Applies gain to the Ambience mixer group.


Fullscreen

Gets or sets whether fullscreen mode is enabled.
Applies directly to Screen.fullScreen.


VSync

Gets or sets whether vertical sync is enabled.
Updates QualitySettings.vSyncCount.


FOV

Gets or sets the camera field of view (degrees).
Also applies to the active player camera if available.


Sensitivity

Gets or sets mouse look sensitivity. Also updates the player look controller if present.


Brightness

Gets or sets screen brightness.
Applied through post-processing color grading.

⚠ Uses reflection to access a private colorGrading field inside SettingsManager.


Quality

Gets or sets the Unity quality level index.
Applies via QualitySettings.SetQualityLevel.


AntiAliasing

Gets or sets anti-aliasing level (0–3 mapped to 0/2/4/8 samples).
Applied via QualitySettings.antiAliasing.

Why use this?

You can also apply settings through SettingsManager.Instance.ApplyAllSettings(), but that applies EVERY setting even when you want to change just one. For example, changing FOV would trigger graphics updates.

These properties apply individual settings without automatically saving them. To persist your changes, call Settings.SettingsInstance.SaveSettings() after setting the properties you want.

ChirpList

A wrapper for Kojo's shitty ChirpData system

public ChirpList(DialogueManager manager)

To use it: create a new Instance of a ChirpList and pass the DialogueManager into it's constructor. Then use it like a dictionary and it will update the DialogueManager.

[!WARNING] Although it implements IDictionary, it does not change the underlying fact that Kojo's List<ChirpData>is O(n). It just makes it easier to use.

ShaderUtils

Some cool methods having to do with shaders.

public static void SetShaderRecursive(GameObject root, Shader shader)

Does exactly what you think it does. Sets the shaders of every Renderer on root and its children, including inactive objects, to whatever you want.

public static void SetColorRecursive(GameObject root, Color color)

Just for fun! Exactly like the previous method, but sets the material color to whatever you want instead.
Used it to create the "Miside Zero but it's the Epstien Files" video

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.