Ejemplo n.º 1
0
            public OvlSections(ROMHandler.ROMHandler rom, ROMHandler.DMATableEntry dma, uint vstart)
            {
                byte[] ovl = new byte[dma.PEnd - dma.PStart];
                Buffer.BlockCopy(rom.Data, (int)dma.PStart, ovl, 0, ovl.Length);

                int indent, secaddr;

                indent  = (int)Endian.SwapUInt32(BitConverter.ToUInt32(ovl, ovl.Length - 4));
                secaddr = (ovl.Length - indent);

                text   = new byte[Endian.SwapUInt32(BitConverter.ToUInt32(ovl, secaddr))];
                textVA = vstart;
                Buffer.BlockCopy(ovl, (int)textVA, text, 0, text.Length);

                data   = new byte[Endian.SwapUInt32(BitConverter.ToUInt32(ovl, secaddr + 4))];
                dataVA = (uint)(textVA + text.Length);
                Buffer.BlockCopy(ovl, (int)dataVA, data, 0, data.Length);

                rodata   = new byte[Endian.SwapUInt32(BitConverter.ToUInt32(ovl, secaddr + 8))];
                rodataVA = (uint)(dataVA + data.Length);
                Buffer.BlockCopy(ovl, (int)rodataVA, rodata, 0, rodata.Length);

                bss   = new byte[Endian.SwapUInt32(BitConverter.ToUInt32(ovl, secaddr + 12))];
                bssVA = (uint)(rodataVA + rodata.Length);
                Buffer.BlockCopy(ovl, (int)bssVA, bss, 0, bss.Length);
            }
Ejemplo n.º 2
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();
                }
            }
Ejemplo n.º 3
0
        public MIPSEvaluator(ROMHandler.ROMHandler rom, ROMHandler.DMATableEntry dma, uint ramadr, RegisterHookDelegate reghook = null, ushort var = 0)
        {
            BaseAddress = ramadr;

            Registers = new uint[32];
            Stack     = new uint[256 * MIPS.SafetyVal];
            StackPos  = (int)(128 * MIPS.SafetyVal);

            Sections = new OvlSections(rom, dma, 0);

            MemoryMap = new List <MemoryRegion>();
            MemoryMap.Add(new MemoryRegion(Sections.text, ramadr + Sections.textVA));
            MemoryMap.Add(new MemoryRegion(Sections.data, ramadr + Sections.dataVA));
            MemoryMap.Add(new MemoryRegion(Sections.rodata, ramadr + Sections.rodataVA));
            MemoryMap.Add(new MemoryRegion(Sections.bss, ramadr + Sections.bssVA));

            RegisterHook = reghook;

            SpecialOps = new List <SpecialOp>();
            SpecialOps.Add(new SpecialOp(MIPS.LH((uint)MIPS.Register.R0, 0x1C, (uint)MIPS.Register.A0), MIPS.LH((uint)MIPS.Register.R0, 0x1C, (uint)MIPS.Register.A0), var));
            SpecialOps.Add(new SpecialOp(MIPS.LH((uint)MIPS.Register.R0, 0x1C, (uint)MIPS.Register.S0), MIPS.LH((uint)MIPS.Register.R0, 0x1C, (uint)MIPS.Register.A0), var));

            Watches = new List <uint>();
        }