Projektdateien hinzufügen.

This commit is contained in:
2024-05-05 15:59:49 +02:00
parent 74da0c6962
commit 7c28a6ee17
242 changed files with 23697 additions and 0 deletions

39
SM64Lib/Datatypecastes.cs Normal file
View File

@@ -0,0 +1,39 @@
using global::System.Runtime.InteropServices;
namespace SM64Lib
{
static class Datatypecastes
{
public static short LongToInt16(long value)
{
var cast = default(CasterLongInt16);
cast.LongValue = value;
return cast.Int16Value;
}
[StructLayout(LayoutKind.Explicit)]
private struct CasterLongInt16
{
[FieldOffset(0)]
public long LongValue;
[FieldOffset(0)]
public short Int16Value;
}
public static byte LongToByte(long value)
{
var cast = default(CasterLongByte);
cast.LongValue = value;
return cast.ByteValue;
}
[StructLayout(LayoutKind.Explicit)]
private struct CasterLongByte
{
[FieldOffset(0)]
public long LongValue;
[FieldOffset(0)]
public byte ByteValue;
}
}
}