/// <summary> /// Returns an address by resolving the pointer's parent references /// </summary> /// <returns></returns> private int GetAddr() { int o = 0; if (Parent != null) { o = Parent.GetAddr() & 0xFFFFFF; o = Zpr.ReadRamInt32(o) & 0xFFFFFF; } return(o + Offset); }
public void Write(params object[] p) { if (p.Length % 2 != 0) { return; } for (int i = 0; i < (p.Length / 2); i++) { int offset = (int)p[i * 2]; object item = p[i * 2 + 1]; if (item is int) { Zpr.WriteRam32(this + offset, (int)item); } else if (item is uint) { Zpr.WriteRam32(this + offset, (int)((uint)item)); } else if (item is float) { Zpr.WriteRam32(this + offset, (float)item); } else if (item is short) { Zpr.WriteRam16(this + offset, (short)item); } else if (item is ushort) { Zpr.WriteRam16(this + offset, (short)((ushort)item)); } else if (item is byte) { Zpr.WriteRam8(this + offset, (byte)item); } } }
public int ReadByte(int offset) { return(Zpr.ReadRamByte(this + offset)); }
public ushort ReadUInt16(int offset) { return((ushort)Zpr.ReadRamInt16(this + offset)); }
public short ReadInt16(int offset) { return(Zpr.ReadRamInt16(this + offset)); }
public float ReadFloat(int offset) { return(System.BitConverter.ToSingle(Zpr.ReadRam(this + offset, 4), 0)); }
public uint ReadUInt32(int offset) { return((uint)Zpr.ReadRamInt32(this + offset)); }
public int ReadInt32(int offset) { return(Zpr.ReadRamInt32(this + offset)); }