Esempio n. 1
0
        public CodeFile()
        {
            var ramStart = SpectrumVariables.Code_Addr;

            VRom = RamDmadata.GetFileAddress(SpectrumVariables.Code_VRom);
            Ram  = new N64PtrRange(ramStart, ramStart + VRom.Size);
        }
Esempio n. 2
0
        //static int Room_Alloc_Table { get { return SpectrumVariables.Room_Allocation_Table; } }
        //public N64PtrRange Ram { get; }
        //public FileAddress VRom { get; set; }

        //public RamRoom(Ptr ptr)
        //{
        //    Ram = new N64PtrRange(
        //        ptr.ReadInt32(0x00),
        //        ptr.ReadInt32(0x04));

        //    int RoomFile = ptr.ReadInt32(0x10);
        //    VRom = RamDmadata.GetFileAddress(RoomFile);
        //}

        //public static RamRoom GetRoomInfo()
        //{
        //    Ptr ptr = SPtr.New(Room_Alloc_Table);
        //    return new RamRoom(ptr);
        //}

        public static List <SimpleFile> GetRoomInfo()
        {
            RoomCtx roomCtx  = new RoomCtx(SpectrumVariables.Room_Context);
            var     roomList = SpectrumVariables.Room_List_Ptr;

            List <SimpleFile> files = new List <SimpleFile>();

            foreach (var item in new RoomCtx.Room[] { roomCtx.CurRoom, roomCtx.PrevRoom })
            {
                if (item.Num == -1)
                {
                    continue;
                }

                if (roomList == 0)
                {
                    continue;
                }

                FileAddress vrom = RamDmadata.GetFileAddress(roomList.RelOff(item.Num * 8).ReadInt32(0));
                N64PtrRange ram  = new N64PtrRange(item.segment, item.segment + vrom.Size);

                SimpleFile file = new SimpleFile()
                {
                    VRom        = vrom,
                    Ram         = ram,
                    Description = $"ROOM {item.Num}: {vrom}"
                };
                files.Add(file);
            }
            return(files);
        }
Esempio n. 3
0
        private void Initialize(BinaryReader br)
        {
            RamStart = br.ReadBigUInt32();
            VRom     = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
            VRam     = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());

            DungeonMarkData = br.ReadBigInt32();
        }
 private void Initialize(int index, BinaryReader br)
 {
     Index        = index;
     RamStart     = br.ReadBigUInt32();
     VRam         = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());
     VRom         = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
     unk          = br.ReadBigUInt32();
     AllocateSize = br.ReadBigInt32();
 }
Esempio n. 5
0
        public RamDmadata()
        {
            Ptr ptr = SpectrumVariables.Dmadata_Addr;

            VRom = new FileAddress(ptr.ReadInt32(0x20), ptr.ReadInt32(0x24));
            Ram  = new N64PtrRange(ptr, ptr + VRom.Size);

            Data = this;
        }
Esempio n. 6
0
        public RamRoom(Ptr ptr)
        {
            Ram = new N64PtrRange(
                ptr.ReadInt32(0x00),
                ptr.ReadInt32(0x04));

            int RoomFile = ptr.ReadInt32(0x10);

            VRom = RamDmadata.GetFileAddress(RoomFile);
        }
Esempio n. 7
0
        public BlockNode(N64Ptr addr)
        {
            Ptr ptr = SPtr.New(addr);

            IsFree = (ptr.ReadInt32(0) & 1) == 1;
            Size   = ptr.ReadUInt32(4);
            Next   = ptr.ReadInt32(8);
            Prev   = ptr.ReadInt32(0xC);
            Ram    = new N64PtrRange(addr, addr + LENGTH);
        }
Esempio n. 8
0
        public RamObject(Ptr ptr)
        {
            Object   = ptr.ReadInt16(0);
            IsLoaded = Object >= 0;
            Object   = Math.Abs(Object);
            N64Ptr addr = ptr.ReadUInt32(4);

            VRom = (MemoryMapper.ObjectFiles.Length <= Object || Object < 0) ? new FileAddress(0, 0) : MemoryMapper.ObjectFiles[Object];
            Ram  = new N64PtrRange(addr, addr + VRom.Size);
        }
Esempio n. 9
0
        public RamObject(Ptr ptr)
        {
            Object   = ptr.ReadInt16(0);
            IsLoaded = Object >= 0;
            Object   = Math.Abs(Object);
            N64Ptr addr = ptr.ReadUInt32(4);

            Size = (ObjectFiles.Length <= Object || Object < 0) ? 0 : ObjectFiles[Object].Size;
            Ram  = new N64PtrRange(addr, addr + Size);
        }
        private void Initialize(int index, BinaryReader br)
        {
            Id   = index;
            VRom = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
            VRam = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());

            RamStart   = br.ReadBigUInt32();
            UnknownPtr = br.ReadBigUInt32();
            Unknown1   = br.ReadBigUInt32();
        }
        public PlayPauseOverlayRecord(int index, BinaryReader br)
        {
            Item = index;

            RamStart = br.ReadBigUInt32();
            VRom     = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
            VRam     = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());
            br.ReadBigUInt32();
            RamFileName = br.ReadBigUInt32();
        }
Esempio n. 12
0
        private void Initialize(int index, BinaryReader br)
        {
            Item = index;

            RamStart    = br.ReadBigUInt32();
            VRom        = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
            VRam        = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());
            Unk_0x14    = br.ReadBigInt32();
            RamFileName = br.ReadBigUInt32();
        }
Esempio n. 13
0
 private void Initialize(int index, BinaryReader br)
 {
     RamStart = br.ReadBigUInt32();
     VRom     = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
     VRam     = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());
     unknown2 = br.ReadBigUInt32();
     InitFunc = br.ReadBigUInt32();
     DestFunc = br.ReadBigUInt32();
     br.BaseStream.Position += 0xC;
     AllocateSize            = br.ReadBigInt32();
 }
Esempio n. 14
0
        private void Initialize(int index, Ptr recordPtr)
        {
            Actor = index;
            VRom  = new FileAddress(recordPtr.ReadUInt32(0x00), recordPtr.ReadUInt32(0x04));
            VRam  = new N64PtrRange(recordPtr.ReadUInt32(0x08), recordPtr.ReadUInt32(0x0C));

            RamStart       = recordPtr.ReadUInt32(0x10);
            VRamActorInfo  = recordPtr.ReadUInt32(0x14);
            RamFileName    = recordPtr.ReadUInt32(0x18);
            AllocationType = recordPtr.ReadUInt16(0x1C);
            NumSpawned     = (sbyte)recordPtr.ReadByte(0x1E);
        }
Esempio n. 15
0
        private void Initialize(int index, BinaryReader br)
        {
            Actor = index;
            VRom  = new FileAddress(br.ReadBigUInt32(), br.ReadBigUInt32());
            VRam  = new N64PtrRange(br.ReadBigUInt32(), br.ReadBigUInt32());

            RamStart       = br.ReadBigUInt32();
            VRamActorInfo  = br.ReadBigUInt32();
            RamFileName    = br.ReadBigUInt32();
            AllocationType = br.ReadBigUInt16();
            NumSpawned     = br.ReadSByte();
        }
Esempio n. 16
0
        public OvlPause(int i, Ptr ptr)
        {
            uint ramFileStart;

            Item = i;

            ramFileStart = ptr.ReadUInt32(0x00);

            VRom = new FileAddress(
                ptr.ReadUInt32(0x04),
                ptr.ReadUInt32(0x08));
            VRam = new N64PtrRange(
                ptr.ReadUInt32(0x0C),
                ptr.ReadUInt32(0x10));
            Ram = new N64PtrRange(ramFileStart, ramFileStart + VRam.Size);

            RamFileName = ptr.ReadUInt32(0x18);
        }
Esempio n. 17
0
        public ThreadStack(N64Ptr addr)
        {
            Ram = new N64PtrRange(addr, addr + 0x20);

            Ptr ptr = SPtr.New(addr);

            NextPtr = ptr.ReadInt32(0x00);
            PrevPtr = ptr.ReadInt32(0x04);
            N64Ptr StartPtr = ptr.ReadInt32(0x08);
            N64Ptr EndPtr   = ptr.ReadInt32(0x0C);

            Unknown = ptr.ReadInt32(0x14);
            //NamePtr = ptr.ReadInt32(0x18);
            Unknown2 = ptr.ReadInt32(0x1C);

            byte[] nameBuff = ptr.Deref(0x18).ReadBytes(0, 0x20);
            Name      = CStr.Get(nameBuff, Encoding.GetEncoding("EUC-JP"), 0x20);
            StackAddr = new NamedBuffer(new N64PtrRange(StartPtr, EndPtr), $"{Name,-13} STACK");
        }
Esempio n. 18
0
        public ActorInstance(RomVersion version, N64Ptr address, ActorMemoryMapper map)
        {
            Ptr ptr = SPtr.New(address);


            ActorId = ptr.ReadUInt16(0);
            Type    = ptr.ReadByte(2);
            Room    = ptr.ReadByte(3);
            Address = address;

            Variable = ptr.ReadUInt16(0x1C);

            Position = new Vector3 <float>(
                ptr.ReadFloat(0x24),
                ptr.ReadFloat(0x28),
                ptr.ReadFloat(0x2C));


            int off = version.Game == Game.OcarinaOfTime ? 0 : 8;

            Rotation = new Vector3 <short>(
                ptr.ReadInt16(0xB4 + off),
                ptr.ReadInt16(0xB6 + off),
                ptr.ReadInt16(0xB8 + off));

            PrevActor       = ptr.ReadInt32(0x120 + off);
            NextActor       = ptr.ReadInt32(0x124 + off);
            Update          = ptr.ReadInt32(0x130 + off);
            ProcessInstance = ptr.ReadByte(0x115);


            map.GetActorIdAndSize(this, out ushort actorId, out uint instanceSize);
            ActorId = actorId;

            Ram = new N64PtrRange(Address, Address + instanceSize);
        }
Esempio n. 19
0
 public NamedBuffer(N64PtrRange addr, string name)
 {
     Ram  = addr;
     Name = name;
 }
Esempio n. 20
0
 public SegmentAddress(int id, N64PtrRange addr)
 {
     Ram     = addr;
     segment = id;
 }
Esempio n. 21
0
 public JFileAddress(N64PtrRange range)
 {
     Start = range.Start.ToString();
     End   = range.End.ToString();
 }
Esempio n. 22
0
        public ActorInstance(RomVersion version, N64Ptr address)
        {
            int instanceSize;
            int off = 0;

            Ptr ptr = SPtr.New(address);


            ActorId = ptr.ReadUInt16(0);
            Type    = ptr.ReadByte(2);
            Room    = ptr.ReadByte(3);
            Address = address;

            try
            {
                if (version.Game == Game.OcarinaOfTime)
                {
                    if (ActorId == 0 && Type == 4)
                    {
                        ActorId       = 0x008F;
                        forcedActorId = true;
                    }
                }
                // & 0xFFF is hack to correct instances with no proper actor id
                instanceSize = OvlActor.GetInstanceSize(ActorId & 0xFFF);
            }
            catch
            {
                instanceSize = 0;
            }

            Ram = new N64PtrRange(Address, Address + instanceSize);


            Variable = ptr.ReadUInt16(0x1C);

            Position = new Vector3 <float>(
                ptr.ReadFloat(0x24),
                ptr.ReadFloat(0x28),
                ptr.ReadFloat(0x2C));


            if (version.Game == Game.OcarinaOfTime)
            {
                off = 0;
            }
            else
            {
                off = 8;
            }

            Rotation = new Vector3 <short>(
                ptr.ReadInt16(0xB4 + off),
                ptr.ReadInt16(0xB6 + off),
                ptr.ReadInt16(0xB8 + off));


            PrevActor = ptr.ReadInt32(0x120 + off);
            NextActor = ptr.ReadInt32(0x124 + off);

            ProcessInstance = ptr.ReadByte(0x115);
        }