Exemplo n.º 1
0
        private static void LinkList(int addr)
        {
            BlockNode node = new BlockNode(addr, Zpr.ReadRam(addr, 0x10));

            Console.Clear();
            List <BlockNode> nodes = new List <BlockNode>()
            {
                node
            };
            var cur = node;

            while (cur.Prev != 0)
            {
                cur = new BlockNode(cur.Prev, Zpr.ReadRam(cur.Prev, 0x10));
                nodes.Add(cur);
            }

            cur = node;
            while (cur.Next != 0)
            {
                cur = new BlockNode(cur.Next, Zpr.ReadRam(cur.Next, 0x10));
                nodes.Add(cur);
            }

            foreach (var item in nodes.OrderBy(x => x.Ram.Start))
            {
                Console.WriteLine($"{item.Ram.Start:X8}:{item.ToString()}");
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            bool flip = true;
            bool dump = false;

            //091CFD80
            Mount();
            string line = "";// = Console.ReadLine();

            while (line != "q")
            {
                line = Console.ReadLine();
                switch (line)
                {
                case "flip": flip = !flip; break;

                case "dump": dump = !dump; break;

                case "link": LinkList(0x08080000); break;

                case "link2": LinkList(0x080A6E40); break;

                case "link3": LinkList(0x08000064); break;

                case "link4": LinkList(0x08002AD0); break;

                case "linkc": LinkListCircular(0x9EA0000); break;

                case "mount": Mount(); break;

                default:
                {
                    long addr;

                    if (!TryEvaluate(line.Trim(), out addr))
                    {
                        continue;
                    }

                    //if (!int.TryParse(line.Trim(), System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out addr))
                    //    continue;
                    if (!dump)
                    {
                        ReadRam((int)addr, flip);
                    }
                    else
                    {
                        Console.Clear();
                        var arr = Zpr.ReadRam((int)addr, 0x100);
                        for (int i = 0; i < 0x100; i++)
                        {
                            Console.Write($"{arr[i]:X2}");
                        }
                    }
                }
                break;
                }
            }
        }
Exemplo n.º 3
0
        private static void Mount()
        {
            Emulator e = new Emulator("citra-qt", "F**k", "`citra-qt.exe`");

            Zpr.TryMountEmulator(new List <Emulator>()
            {
                e
            });
        }
Exemplo n.º 4
0
 public Test(int addr)
 {
     Address = addr;
     Id      = Zpr.ReadRamInt16(addr);
     Unk1    = Zpr.ReadRamInt16(addr + 2);
     Unk2    = Zpr.ReadRamInt32(addr + 4);
     Prev    = Zpr.ReadRamInt32(addr + 8);
     Next    = Zpr.ReadRamInt32(addr + 0xC);
 }
Exemplo n.º 5
0
        public static List <BlockNode> GetBlockList(int address)
        {
            List <BlockNode> list = new();
            BlockNode        working;

            if (address == 0)
            {
                return(list);
            }

            int addr = address;

            do
            {
                working = new BlockNode(addr, Zpr.ReadMem(new IntPtr(addr), LENGTH));
                list.Add(working);
                addr = working.Next;
            }while (working.Next != 0);
            return(list);
        }
Exemplo n.º 6
0
        private static void ReadRam(int addr, bool flip)
        {
            Console.Clear();
            long emuAddr    = 0;
            long emuAddrOld = 0;

            if (flip)
            {
                for (int i = 0; i < 0x100; i += 0x10)
                {
                    emuAddr = Zpr.GetEmulatedAddress(addr);
                    if (emuAddrOld != emuAddr)
                    {
                        Console.WriteLine($"{emuAddr:X16}");
                        emuAddrOld = emuAddr;
                    }
                    int addrLocal = addr + i;
                    Console.WriteLine($"{addrLocal:X8} {Zpr.ReadRamInt32(addrLocal + 0):X8} {Zpr.ReadRamInt32(addrLocal + 4):X8} {Zpr.ReadRamInt32(addrLocal + 0x8):X8} {Zpr.ReadRamInt32(addrLocal + 0xC):X8}");
                }
            }
            else
            {
                byte[] arr = Zpr.ReadRam(addr, 0x100);

                emuAddr = Zpr.GetEmulatedAddress(addr);
                Console.WriteLine($"{emuAddr:X16}");

                for (int i = 0; i < 0x100; i += 0x10)
                {
                    Console.Write($"{(addr + i):X8}");
                    for (int j = 0; j < 0x10; j += 4)
                    {
                        Console.Write($" {arr[i + j]:X2}{arr[i + j + 1]:X2}{arr[i + j + 2]:X2}{arr[i + j + 3]:X2}");
                    }
                    Console.WriteLine();
                }
            }
        }
Exemplo n.º 7
0
        private static void LinkListCircular(int addr)
        {
            Test node = new Test(addr);

            Console.Clear();
            List <Test> nodes = new List <Test>()
            {
                node
            };

            Test cur = node;

            while (cur.Next != node.Address && cur.Next != 0)
            {
                cur = new Test(cur.Next);
                nodes.Add(cur);
            }

            foreach (var item in nodes.OrderBy(x => x.Address))
            {
                Console.WriteLine($"{Zpr.GetEmulatedAddress(item.Address):X16}:{item.ToString()}");
            }
        }