예제 #1
0
            public HeaderPair(HeaderLoader sh, List <HeaderLoader> rhs)
            {
                SceneHeader = sh;
                RoomHeaders = rhs;

                Description = null;
            }
예제 #2
0
파일: Generic.cs 프로젝트: kskjer/SceneNavi
 public Generic(ROMHandler.ROMHandler rom, IHeaderParent parent, HeaderLoader.CommandTypeIDs cmdid)
 {
     ROM = rom;
     InROM = false;
     Command = cmdid;
     Offset = -1;
     Data = ulong.MaxValue;
     Parent = parent;
 }
예제 #3
0
        public void ReadScene(HeaderCommands.Rooms forcerooms = null)
        {
            Program.Status.Message = string.Format("Reading scene '{0}'...", this.Name);

            ROM.SegmentMapping.Remove((byte)0x02);
            ROM.SegmentMapping.Add((byte)0x02, data);

            sceneHeaders = new List <HeaderLoader>();

            HeaderLoader newheader = null;

            HeaderCommands.Rooms     rooms = null;
            HeaderCommands.Collision coll  = null;

            if (data[0] == (byte)HeaderLoader.CommandTypeIDs.SettingsSoundScene || data[0] == (byte)HeaderLoader.CommandTypeIDs.Rooms ||
                BitConverter.ToUInt32(data, 0) == (byte)HeaderLoader.CommandTypeIDs.SubHeaders)
            {
                /* Get rooms & collision command from first header */
                newheader = new HeaderLoader(ROM, this, (byte)0x02, 0, 0);

                /* If external rooms should be forced, overwrite command in header */
                if (forcerooms != null)
                {
                    int roomidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms);
                    if (roomidx != -1)
                    {
                        newheader.Commands[roomidx] = forcerooms;
                    }
                }

                rooms = newheader.Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms) as HeaderCommands.Rooms;
                coll  = newheader.Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Collision) as HeaderCommands.Collision;
                sceneHeaders.Add(newheader);

                if (BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), 0) == 0x18)
                {
                    int  hnum = 1;
                    uint aofs = Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), 4));
                    while (true)
                    {
                        uint rofs = Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), (int)(aofs & 0x00FFFFFF)));
                        if (rofs != 0)
                        {
                            if ((rofs & 0x00FFFFFF) > ((byte[])ROM.SegmentMapping[(byte)0x02]).Length || (rofs >> 24) != 0x02)
                            {
                                break;
                            }
                            newheader = new HeaderLoader(ROM, this, (byte)0x02, (int)(rofs & 0x00FFFFFF), hnum++);

                            /* Get room command index... */
                            int roomidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms);

                            /* If external rooms should be forced, overwrite command in header */
                            if (roomidx != -1 && forcerooms != null)
                            {
                                newheader.Commands[roomidx] = forcerooms;
                            }

                            /* If rooms were found in first header, force using these! */
                            if (roomidx != -1 && rooms != null)
                            {
                                newheader.Commands[roomidx] = rooms;
                            }

                            /* If collision was found in header, force */
                            int collidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Collision);
                            if (collidx != -1 && coll != null)
                            {
                                newheader.Commands[collidx] = coll;
                            }

                            sceneHeaders.Add(newheader);
                        }
                        aofs += 4;
                    }
                }

                currentSceneHeader = sceneHeaders[0];
            }
        }
예제 #4
0
 public void SetCurrentSceneHeader(HeaderLoader header)
 {
     currentSceneHeader = header;
 }
예제 #5
0
 public void SetCurrentSceneHeader(HeaderLoader header)
 {
     currentSceneHeader = header;
 }
예제 #6
0
        public void ReadScene(HeaderCommands.Rooms forcerooms = null)
        {
            Program.Status.Message = string.Format("Reading scene '{0}'...", this.Name);

            ROM.SegmentMapping.Remove((byte)0x02);
            ROM.SegmentMapping.Add((byte)0x02, data);

            sceneHeaders = new List<HeaderLoader>();

            HeaderLoader newheader = null;
            HeaderCommands.Rooms rooms = null;
            HeaderCommands.Collision coll = null;

            if (data[0] == (byte)HeaderLoader.CommandTypeIDs.SettingsSoundScene || data[0] == (byte)HeaderLoader.CommandTypeIDs.Rooms ||
                BitConverter.ToUInt32(data, 0) == (byte)HeaderLoader.CommandTypeIDs.SubHeaders)
            {
                /* Get rooms & collision command from first header */
                newheader = new HeaderLoader(ROM, this, (byte)0x02, 0, 0);

                /* If external rooms should be forced, overwrite command in header */
                if (forcerooms != null)
                {
                    int roomidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms);
                    if (roomidx != -1) newheader.Commands[roomidx] = forcerooms;
                }

                rooms = newheader.Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms) as HeaderCommands.Rooms;
                coll = newheader.Commands.FirstOrDefault(x => x.Command == HeaderLoader.CommandTypeIDs.Collision) as HeaderCommands.Collision;
                sceneHeaders.Add(newheader);

                if (BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), 0) == 0x18)
                {
                    int hnum = 1;
                    uint aofs = Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), 4));
                    while (true)
                    {
                        uint rofs = Endian.SwapUInt32(BitConverter.ToUInt32(((byte[])ROM.SegmentMapping[(byte)0x02]), (int)(aofs & 0x00FFFFFF)));
                        if (rofs != 0)
                        {
                            if ((rofs & 0x00FFFFFF) > ((byte[])ROM.SegmentMapping[(byte)0x02]).Length || (rofs >> 24) != 0x02) break;
                            newheader = new HeaderLoader(ROM, this, (byte)0x02, (int)(rofs & 0x00FFFFFF), hnum++);

                            /* Get room command index... */
                            int roomidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Rooms);

                            /* If external rooms should be forced, overwrite command in header */
                            if (roomidx != -1 && forcerooms != null) newheader.Commands[roomidx] = forcerooms;

                            /* If rooms were found in first header, force using these! */
                            if (roomidx != -1 && rooms != null) newheader.Commands[roomidx] = rooms;

                            /* If collision was found in header, force */
                            int collidx = newheader.Commands.FindIndex(x => x.Command == HeaderLoader.CommandTypeIDs.Collision);
                            if (collidx != -1 && coll != null) newheader.Commands[collidx] = coll;

                            sceneHeaders.Add(newheader);
                        }
                        aofs += 4;
                    }
                }

                currentSceneHeader = sceneHeaders[0];
            }
        }
예제 #7
0
            public HeaderPair(HeaderLoader sh, List<HeaderLoader> rhs)
            {
                SceneHeader = sh;
                RoomHeaders = rhs;

                Description = null;
            }