Example #1
0
            public RoomInfoClass(ROMHandler.ROMHandler rom, IHeaderParent parent, int num, uint s = 0, uint e = 0)
            {
                ROM = rom;
                Start = s;
                End = e;
                Parent = parent;
                Number = (ulong)num;

                if (Start != 0 && End != 0 && Start < rom.Data.Length && End < rom.Data.Length)
                {
                    ROMHandler.DMATableEntry dma = ROM.Files.Find(x => x.PStart == Start);
                    if (dma != null) DMAFilename = dma.Name;

                    Data = new byte[End - Start];
                    Array.Copy(ROM.Data, Start, Data, 0, End - Start);

                    if ((Description = (ROM.XMLRoomNames.Names[Start] as string)) == null)
                    {
                        ROMHandler.ISceneTableEntry parentste = (parent as ROMHandler.ISceneTableEntry);
                        if (parentste.IsNameExternal())
                        {
                            Description = string.Format("Room {0}", (Number + 1));
                        }
                        else
                        {
                            if (dma != null)
                                Description = DMAFilename;
                            else
                                Description = string.Format("S{0:X}-E{1:X}", Start, End);
                        }
                    }

                    Load();
                }
            }
Example #2
0
 public Generic(ROMHandler.ROMHandler rom, IHeaderParent parent, HeaderLoader.CommandTypeIDs cmdid)
 {
     ROM = rom;
     InROM = false;
     Command = cmdid;
     Offset = -1;
     Data = ulong.MaxValue;
     Parent = parent;
 }
Example #3
0
 public Generic(ROMHandler.ROMHandler rom, IHeaderParent parent, HeaderLoader.CommandTypeIDs cmdid)
 {
     ROM     = rom;
     InROM   = false;
     Command = cmdid;
     Offset  = -1;
     Data    = ulong.MaxValue;
     Parent  = parent;
 }
Example #4
0
            public RoomInfoClass(ROMHandler.ROMHandler rom, IHeaderParent parent, string fn)
            {
                ROM    = rom;
                Parent = parent;

                System.IO.FileStream fs = new System.IO.FileStream(fn, System.IO.FileMode.Open);
                Data = new byte[fs.Length];
                fs.Read(Data, 0, (int)fs.Length);
                fs.Close();

                Description = System.IO.Path.GetFileNameWithoutExtension(fn);

                Load();
            }
Example #5
0
        public HeaderLoader(ROMHandler rom, IHeaderParent parent, byte seg, int ofs, int number)
        {
            Parent = parent;

            Offset = ofs;
            Segment = seg;
            Number = number;

            Commands = new List<Generic>();
            Generic cmd = null;
            while ((cmd = new Generic(rom, parent, seg, ref ofs)).Command != CommandTypeIDs.EndOfHeader)
            {
                Type cmdtype = (Type)CommandTypes[cmd.Command];
                object inst = Activator.CreateInstance((cmdtype == null ? typeof(Generic) : cmdtype), new object[] { cmd });
                Commands.Add((Generic)inst);
            }
        }
Example #6
0
        public HeaderLoader(ROMHandler rom, IHeaderParent parent, byte seg, int ofs, int number)
        {
            Parent = parent;

            Offset  = ofs;
            Segment = seg;
            Number  = number;

            Commands = new List <Generic>();
            Generic cmd = null;

            while ((cmd = new Generic(rom, parent, seg, ref ofs)).Command != CommandTypeIDs.EndOfHeader)
            {
                Type   cmdtype = (Type)CommandTypes[cmd.Command];
                object inst    = Activator.CreateInstance((cmdtype == null ? typeof(Generic) : cmdtype), new object[] { cmd });
                Commands.Add((Generic)inst);
            }
        }
Example #7
0
        public Generic(ROMHandler.ROMHandler rom, IHeaderParent parent, byte seg, ref int ofs)
        {
            ROM = rom;
            Command = (HeaderLoader.CommandTypeIDs)((byte[])rom.SegmentMapping[seg])[ofs];
            Offset = ofs;
            Data = Endian.SwapUInt64(BitConverter.ToUInt64(((byte[])rom.SegmentMapping[seg]), ofs));
            Parent = parent;
            ofs += 8;

            if (parent is HeaderCommands.Rooms.RoomInfoClass && (parent as HeaderCommands.Rooms.RoomInfoClass).Parent is SceneTableEntryOcarina)
            {
                ISceneTableEntry ste = ((parent as HeaderCommands.Rooms.RoomInfoClass).Parent as ISceneTableEntry);
                InROM = ste.IsInROM();
            }
            else if (parent is ISceneTableEntry)
            {
                InROM = (parent as ISceneTableEntry).IsInROM();
            }
        }
Example #8
0
        public Generic(ROMHandler.ROMHandler rom, IHeaderParent parent, byte seg, ref int ofs)
        {
            ROM     = rom;
            Command = (HeaderLoader.CommandTypeIDs)((byte[])rom.SegmentMapping[seg])[ofs];
            Offset  = ofs;
            Data    = Endian.SwapUInt64(BitConverter.ToUInt64(((byte[])rom.SegmentMapping[seg]), ofs));
            Parent  = parent;
            ofs    += 8;

            if (parent is HeaderCommands.Rooms.RoomInfoClass && (parent as HeaderCommands.Rooms.RoomInfoClass).Parent is SceneTableEntryOcarina)
            {
                ISceneTableEntry ste = ((parent as HeaderCommands.Rooms.RoomInfoClass).Parent as ISceneTableEntry);
                InROM = ste.IsInROM();
            }
            else if (parent is ISceneTableEntry)
            {
                InROM = (parent as ISceneTableEntry).IsInROM();
            }
        }
Example #9
0
            public RoomInfoClass(ROMHandler.ROMHandler rom, IHeaderParent parent, string fn)
            {
                ROM = rom;
                Parent = parent;

                System.IO.FileStream fs = new System.IO.FileStream(fn, System.IO.FileMode.Open);
                Data = new byte[fs.Length];
                fs.Read(Data, 0, (int)fs.Length);
                fs.Close();

                Description = System.IO.Path.GetFileNameWithoutExtension(fn);

                Load();
            }
Example #10
0
 public Rooms(ROMHandler.ROMHandler rom, IHeaderParent parent, string fn)
     : base(rom, parent, HeaderLoader.CommandTypeIDs.Rooms)
 {
     RoomInformation = new List<RoomInfoClass>();
     RoomInformation.Add(new RoomInfoClass(rom, parent, fn));
 }