1
0
mirror of synced 2024-11-30 18:24:39 +01:00
Switch-Toolbox/Switch_Toolbox_Library/IO/IOComoon.cs
KillzXGaming 2cc2269bab Add support for DKCTF Wii U and Switch files.
Supports loading rigged models and viewing textures for both the Wii U and Switch versions of the game.
Keep in mind the Switch version lacks LZSS 3 byte compression and will be missing vertex data for certain models.
2022-10-26 19:33:56 -04:00

31 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace Toolbox.Library.IO
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct Magic
{
int value;
public static implicit operator string(Magic magic) => Encoding.ASCII.GetString(BitConverter.GetBytes(magic.value));
public static implicit operator Magic(string s) => new Magic { value = BitConverter.ToInt32(Encoding.ASCII.GetBytes(s), 0) };
public override string ToString()
{
return Encoding.ASCII.GetString(BitConverter.GetBytes(value));
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct Magic8
{
long value;
public static implicit operator string(Magic8 magic) => Encoding.ASCII.GetString(BitConverter.GetBytes(magic.value));
public static implicit operator Magic8(string s) => new Magic8 { value = BitConverter.ToInt64(Encoding.ASCII.GetBytes(s), 0) };
}
}