Esempio n. 1
0
        public void QUERY_set_cdl(ICodeDataLog cdl)
        {
            WritePipeMessage(eMessage.eMessage_QUERY_set_cdl);
            if (cdl == null)
            {
                for (int i = 0; i < 4 * 2; i++)
                {
                    WritePipePointer(IntPtr.Zero);
                }
            }
            else
            {
                WritePipePointer(cdl.GetPin("CARTROM"), false);
                bwPipe.Write(cdl["CARTROM"].Length);

                if (cdl.Has("CARTRAM"))
                {
                    WritePipePointer(cdl.GetPin("CARTRAM"), false);
                    bwPipe.Write(cdl["CARTRAM"].Length);
                }
                else
                {
                    WritePipePointer(IntPtr.Zero);
                    WritePipePointer(IntPtr.Zero);
                }

                WritePipePointer(cdl.GetPin("WRAM"));
                bwPipe.Write(cdl["WRAM"].Length);

                WritePipePointer(cdl.GetPin("APURAM"), false);
                bwPipe.Write(cdl["APURAM"].Length);
                bwPipe.Flush();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Tests whether the other CodeDataLog is structurally identical
        /// </summary>
        public bool Check(ICodeDataLog other)
        {
            if (SubType != other.SubType)
            {
                return(false);
            }

            if (SubVer != other.SubVer)
            {
                return(false);
            }

            if (Count != other.Count)
            {
                return(false);
            }

            foreach (var(scope, data) in this)
            {
                if (!other.TryGetValue(scope, out var oval) || oval.Length != data.Length)
                {
                    return(false);
                }
            }
            // don't need to check keys present in other but not in this -- `Count` would differ

            return(true);
        }
Esempio n. 3
0
		public void QUERY_set_cdl(ICodeDataLog cdl)
		{
			for (int i = 0; i < 4; i++)
			{
				comm->cdl_ptr[i] = 0;
				comm->cdl_size[i] = 0;
			}

			if (cdl != null)
			{
				comm->cdl_ptr[0] = cdl.GetPin("CARTROM").ToInt64();
				comm->cdl_size[0] = cdl["CARTROM"].Length;
				if (cdl.Has("CARTRAM"))
				{
					comm->cdl_ptr[1] = cdl.GetPin("CARTRAM").ToInt64();
					comm->cdl_size[1] = cdl["CARTRAM"].Length;
				}

				comm->cdl_ptr[2] = cdl.GetPin("WRAM").ToInt64();
				comm->cdl_size[2] = cdl["WRAM"].Length;

				comm->cdl_ptr[2] = cdl.GetPin("APURAM").ToInt64();
				comm->cdl_size[2] = cdl["APURAM"].Length;
			}

			Message(eMessage.eMessage_QUERY_set_cdl);

		}
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["CARTROM"] = new byte[_memoryDomains["CARTROM"].Size];
            cdl["WRAM"]    = new byte[_memoryDomains["WRAM"].Size];
            cdl["APURAM"]  = new byte[_memoryDomains["APURAM"].Size];

            if (_memoryDomains.Has("CARTRAM"))
            {
                cdl["CARTRAM"] = new byte[_memoryDomains["CARTRAM"].Size];
            }

            if (IsSGB)
            {
                cdl["SGB_CARTROM"] = new byte[_memoryDomains["SGB CARTROM"].Size];
                cdl["SGB_HRAM"]    = new byte[_memoryDomains["SGB HRAM"].Size];
                cdl["SGB_WRAM"]    = new byte[_memoryDomains["SGB WRAM"].Size];

                if (_memoryDomains.Has("SGB CARTRAM"))
                {
                    cdl["SGB_CARTRAM"] = new byte[_memoryDomains["SGB CARTRAM"].Size];
                }
            }

            cdl.SubType = "SNES";
            cdl.SubVer  = 0;
        }
Esempio n. 5
0
 void ICodeDataLogger.SetCDL(ICodeDataLog cdl)
 {
     for (int i = 0; i < _numCores; i++)
     {
         _linkedCores[i].SetCDL(cdl, $"P{i + 1} ");
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Tests whether the other CodeDataLog is structurally identical
        /// </summary>
        public bool Check(ICodeDataLog other)
        {
            if (SubType != other.SubType)
            {
                return(false);
            }

            if (SubVer != other.SubVer)
            {
                return(false);
            }

            if (Count != other.Count)
            {
                return(false);
            }

            foreach (var kvp in this)
            {
                if (!other.ContainsKey(kvp.Key))
                {
                    return(false);
                }

                var oval = other[kvp.Key];
                if (oval.Length != kvp.Value.Length)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 7
0
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["RAM"] = new byte[MemoryDomains["Main RAM"].Size];
            cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];

            cdl.SubType = "VEC";
            cdl.SubVer  = 0;
        }
        public void SetCDL(ICodeDataLog cdl)
        {
            _currCdl?.Unpin();
            _currCdl = cdl;
            _currCdl?.Pin();

            // set it no matter what. if its null, the cdl will be unhooked from libsnes internally
            Api.QUERY_set_cdl(_currCdl);
        }
Esempio n. 9
0
        void ICodeDataLogger.DisassembleCDL(Stream s, ICodeDataLog cdl)
        {
            // this doesn't actually do anything

            /*
             * for (int i = 0; i < _numCores; i++)
             * {
             *      _linkedCores[i].DisassembleCDL(s, cdl);
             * }
             */
        }
 void ICodeDataLogger.SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
     if (cdl == null)
     {
         LibGambatte.gambatte_setcdcallback(GambatteState, null);
     }
     else
     {
         LibGambatte.gambatte_setcdcallback(GambatteState, CDCallback);
     }
 }
 public void SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
     if (cdl == null)
     {
         Core.gpgx_set_cd_callback(null);
     }
     else
     {
         Core.gpgx_set_cd_callback(CDCallback);
     }
 }
Esempio n. 12
0
        public void QUERY_set_cdl(ICodeDataLog cdl)
        {
            if (_exe == null)
            {
                return;
            }

            using (_exe.EnterExit())
            {
                for (int i = 0; i < 8; i++)
                {
                    _comm->cdl_ptr[i]  = 0;
                    _comm->cdl_size[i] = 0;
                }

                if (cdl != null)
                {
                    _comm->cdl_ptr[0]  = cdl.GetPin("CARTROM").ToInt64();
                    _comm->cdl_size[0] = cdl["CARTROM"].Length;
                    if (cdl.Has("CARTRAM"))
                    {
                        _comm->cdl_ptr[1]  = cdl.GetPin("CARTRAM").ToInt64();
                        _comm->cdl_size[1] = cdl["CARTRAM"].Length;
                    }

                    _comm->cdl_ptr[2]  = cdl.GetPin("WRAM").ToInt64();
                    _comm->cdl_size[2] = cdl["WRAM"].Length;

                    _comm->cdl_ptr[3]  = cdl.GetPin("APURAM").ToInt64();
                    _comm->cdl_size[3] = cdl["APURAM"].Length;

                    if (cdl.Has("SGB_CARTROM"))
                    {
                        _comm->cdl_ptr[4]  = cdl.GetPin("SGB_CARTROM").ToInt64();
                        _comm->cdl_size[4] = cdl["SGB_CARTROM"].Length;

                        if (cdl.Has("SGB_CARTRAM"))
                        {
                            _comm->cdl_ptr[5]  = cdl.GetPin("SGB_CARTRAM").ToInt64();
                            _comm->cdl_size[5] = cdl["SGB_CARTRAM"].Length;
                        }

                        _comm->cdl_ptr[6]  = cdl.GetPin("SGB_WRAM").ToInt64();
                        _comm->cdl_size[6] = cdl["SGB_WRAM"].Length;

                        _comm->cdl_ptr[7]  = cdl.GetPin("SGB_HRAM").ToInt64();
                        _comm->cdl_size[7] = cdl["SGB_HRAM"].Length;
                    }
                }

                _core.Message(eMessage.eMessage_QUERY_set_cdl);
            }
        }
Esempio n. 13
0
 public void SetCDL(ICodeDataLog cdl)
 {
     _cdl = cdl;
     if (cdl == null)
     {
         this.L.cpu.CDLCallback = null;
     }
     else
     {
         this.L.cpu.CDLCallback = CDLCpuCallback;
     }
 }
Esempio n. 14
0
 public void SetCDL(ICodeDataLog cdl)
 {
     _cdl = cdl;
     if (cdl == null || !cdl.Active)
     {
         _cpu.ReadMemory = _machine.ReadMemory;
     }
     else
     {
         _cpu.ReadMemory = ReadMemory_CDL;
     }
 }
Esempio n. 15
0
        public void NewCDL(ICodeDataLog cdl)
        {
            void AddIfExists(string name)
            {
                var found = _memoryDomains[name];

                if (found is not null)
                {
                    cdl[name] = new byte[found.Size];
                }
            }

            cdl["ROM"]      = new byte[_memoryDomains["ROM"] !.Size];
        public void NewCDL(ICodeDataLog cdl)
        {
            InitCDLMappings();
            var mm = this.Cpu.Mappings;

            foreach (var kvp in SizesFromHuMap(mm))
            {
                cdl[kvp.Key] = new byte[kvp.Value];
            }

            cdl.SubType = "PCE";
            cdl.SubVer  = 0;
        }
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["MD CART"] = new byte[MemoryDomains["MD CART"].Size];
            cdl["68K RAM"] = new byte[MemoryDomains["68K RAM"].Size];
            cdl["Z80 RAM"] = new byte[MemoryDomains["Z80 RAM"].Size];

            if (MemoryDomains.Has("SRAM"))
            {
                cdl["SRAM"] = new byte[MemoryDomains["SRAM"].Size];
            }

            cdl.SubType = "GEN";
            cdl.SubVer  = 0;
        }
Esempio n. 18
0
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];

            // cdl["HRAM"] = new byte[_memoryDomains["HRAM"].Size]; //this is probably useless, but it's here if someone needs it
            cdl["WRAM"] = new byte[MemoryDomains["WRAM"].Size];

            if (MemoryDomains.Has("CartRAM"))
            {
                cdl["CartRAM"] = new byte[MemoryDomains["CartRAM"].Size];
            }

            cdl.SubType = "GB";
            cdl.SubVer  = 0;
        }
Esempio n. 19
0
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["ROM"]  = new byte[MemoryDomains["ROM L"].Size];
            cdl["HRAM"] = new byte[MemoryDomains["Zero Page RAM L"].Size];

            cdl["WRAM"] = new byte[MemoryDomains["Main RAM L"].Size];

            if (MemoryDomains.Has("Cart RAM L"))
            {
                cdl["CartRAM"] = new byte[MemoryDomains["Cart RAM L"].Size];
            }

            cdl.SubType = "GB";
            cdl.SubVer  = 0;
        }
 public void SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
     if (cdl == null)
     {
         cpu.ReadMemory  = ReadMemory;
         cpu.WriteMemory = WriteMemory;
         cpu.PeekMemory  = PeekMemory;
     }
     else
     {
         cpu.ReadMemory  = ReadMemory_CDL;
         cpu.WriteMemory = WriteMemory;
         cpu.PeekMemory  = FetchMemory_CDL;
     }
 }
Esempio n. 21
0
 public void SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
     if (cdl == null)
     {
         L.Cpu.ReadMemory  = L.ReadMemory;
         L.Cpu.WriteMemory = L.WriteMemory;
         L.Cpu.FetchMemory = L.FetchMemory;
     }
     else
     {
         L.Cpu.ReadMemory  = ReadMemory_CDL;
         L.Cpu.WriteMemory = L.WriteMemory;
         L.Cpu.FetchMemory = FetchMemory_CDL;
     }
 }
Esempio n. 22
0
 public void SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
     if (cdl == null)
     {
         Cpu.ReadMemory  = ReadMemory;
         Cpu.WriteMemory = WriteMemory;
         Cpu.FetchMemory = FetchMemory_StubThunk;
     }
     else
     {
         Cpu.ReadMemory  = ReadMemory_CDL;
         Cpu.WriteMemory = WriteMemory;
         Cpu.FetchMemory = FetchMemory_CDL;
     }
 }
Esempio n. 23
0
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["ROM"]      = new byte[MemoryDomains["ROM"].Size];
            cdl["Main RAM"] = new byte[MemoryDomains["Main RAM"].Size];

            if (MemoryDomains.Has("Save RAM"))
            {
                cdl["Save RAM"] = new byte[MemoryDomains["Save RAM"].Size];
            }

            if (MemoryDomains.Has("Cart (Volatile) RAM"))
            {
                cdl["Cart (Volatile) RAM"] = new byte[MemoryDomains["Cart (Volatile) RAM"].Size];
            }

            cdl.SubType = "SMS";
            cdl.SubVer  = 0;
        }
Esempio n. 24
0
        public void NewCDL(ICodeDataLog cdl)
        {
            cdl["RAM"] = new byte[_memoryDomains["RAM"].Size];

            if (_memoryDomains.Has("Save RAM"))
            {
                cdl["Save RAM"] = new byte[_memoryDomains["Save RAM"].Size];
            }

            if (_memoryDomains.Has("Battery RAM"))
            {
                cdl["Battery RAM"] = new byte[_memoryDomains["Battery RAM"].Size];
            }

            if (_memoryDomains.Has("Battery RAM"))
            {
                cdl["Battery RAM"] = new byte[_memoryDomains["Battery RAM"].Size];
            }

            cdl.SubType = "NES";
            cdl.SubVer  = 0;
        }
Esempio n. 25
0
        /// <exception cref="InvalidDataException">
        /// <paramref name="other"/> is not the same length as <see langword="this"/>, or
        /// any value differs in size from the corresponding value in <paramref name="other"/>
        /// </exception>
        public void LogicalOrFrom(ICodeDataLog other)
        {
            if (Count != other.Count)
            {
                throw new InvalidDataException("Dictionaries must have the same number of keys!");
            }

            foreach (var(scope, fromData) in other)
            {
                var toData = this[scope];

                if (fromData.Length != toData.Length)
                {
                    throw new InvalidDataException("Memory regions must be the same size!");
                }

                for (int i = 0; i < toData.Length; i++)
                {
                    toData[i] |= fromData[i];
                }
            }
        }
Esempio n. 26
0
        public void DisassembleCDL(Stream s, ICodeDataLog cdl, IMemoryDomains mem)
        {
            var w = new StreamWriter(s);

            w.WriteLine("; Bizhawk CDL Disassembly");
            w.WriteLine();
            foreach (var kvp in cdl)
            {
                w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);

                byte[] cd = kvp.Value;
                var    md = mem[kvp.Key] !;

                for (int i = 0; i < kvp.Value.Length; i++)
                {
                    if ((kvp.Value[i] & (byte)CDLUsage.Code) != 0)
                    {
                        int    unused;
                        string dis = DisassembleExt(
                            0,
                            out unused,
                            delegate(ushort addr)
                        {
                            return(md.PeekByte(addr + i));
                        },
                            delegate(ushort addr)
                        {
                            return(md.PeekUshort(addr + i, false));
                        }
                            );
                        w.WriteLine("0x{0:x8}: {1}", i, dis);
                    }
                }
                w.WriteLine();
            }
            w.WriteLine("; EOF");
            w.Flush();
        }
Esempio n. 27
0
        public void LogicalOrFrom(ICodeDataLog other)
        {
            if (Count != other.Count)
            {
                throw new InvalidDataException("Dictionaries must have the same number of keys!");
            }

            foreach (var kvp in other)
            {
                byte[] fromdata = kvp.Value;
                byte[] todata   = this[kvp.Key];

                if (fromdata.Length != todata.Length)
                {
                    throw new InvalidDataException("Memory regions must be the same size!");
                }

                for (int i = 0; i < todata.Length; i++)
                {
                    todata[i] |= fromdata[i];
                }
            }
        }
Esempio n. 28
0
 void ICodeDataLogger.DisassembleCDL(Stream s, ICodeDataLog cdl)
 {
 }
Esempio n. 29
0
 public void SetCDL(ICodeDataLog cdl)
 {
     CDL = cdl;
 }
Esempio n. 30
0
 public void DisassembleCDL(Stream s, ICodeDataLog cdl)
 {
 }