public static BlastCheat GenerateUnit(string _domain, long _address)
        {
            try
            {
                BizHawk.Client.Common.DisplayType _displaytype = BizHawk.Client.Common.DisplayType.Unsigned;
                bool _bigEndian = false;
                int  _value     = 0;
                long Address    = 0;

                if (RTC_Core.coreForm.cbFreezeEngineActive.Checked && ActiveTableReady)
                {
                    Address = GetAdressFromActiveTable();
                }
                else
                {
                    Address = RTC_Core.LongRandom(RTC_Core.hexeditor._domain.Size);
                }

                return(new BlastCheat(_domain, Address, _displaytype, _bigEndian, _value, true, true));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong in the RTC Freeze Engine. \n" +
                                "This is not a BizHawk error so you should probably send a screenshot of this to the devs\n\n" +
                                ex.ToString());
                return(null);
            }
        }
Esempio n. 2
0
        //The freeze engine is very similar to the Hellgenie and shares common functions with it. See RTC_HellgenieEngine.cs for cheat-related methods.

        public static BlastCheat GenerateUnit(string _domain, long _address)
        {
            try
            {
                MemoryDomainProxy mdp = RTC_MemoryDomains.getProxy(_domain, _address);
                BizHawk.Client.Common.DisplayType _displaytype = BizHawk.Client.Common.DisplayType.Unsigned;

                byte[] _value;
                if (RTC_Core.CustomPrecision == -1)
                {
                    _value = new byte[mdp.WordSize];
                }
                else
                {
                    _value = new byte[RTC_Core.CustomPrecision];
                }

                long safeAddress = _address - (_address % _value.Length);

                for (int i = 0; i < _value.Length; i++)
                {
                    _value[i] = 0;
                }
                //_value[i] = mdp.PeekByte(safeAddress + i);

                return(new BlastCheat(_domain, safeAddress, _displaytype, mdp.BigEndian, _value, true, true));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong in the RTC Freeze Engine. \n" +
                                "This is not a BizHawk error so you should probably send a screenshot of this to the devs\n\n" +
                                ex.ToString());
                return(null);
            }
        }
Esempio n. 3
0
        public BlastCheat(string _domain, long _address, BizHawk.Client.Common.DisplayType _displayType, bool _bigEndian, int _value, bool _isEnabled, bool _isFreeze)
        {
            var settings = new RamSearchEngine.Settings(RTC_Core.hexeditor.MemoryDomains);


            Domain  = _domain;
            address = _address;

            size        = settings.Size;
            displayType = settings.Type;
            bigEndian   = settings.BigEndian;

            //DisplayType = _displayType;
            //BigEndian = _bigEndian;

            value     = _value;
            IsEnabled = _isEnabled;
            IsFreeze  = _isFreeze;
        }
Esempio n. 4
0
        public static StashKey getRawBlastlayer()
        {
            RTC_Core.StopSound();

            StashKey sk = RTC_StockpileManager.SaveState_NET(false);

            BlastLayer bl = new BlastLayer();

            foreach (var item in Global.CheatList)
            {
                string[] disassembleCheat = item.Name.Split('|');

                if (disassembleCheat[0] == "RTC Cheat")
                {
                    string _domain  = disassembleCheat[1];
                    long   _address = Convert.ToInt64(disassembleCheat[2]);

                    BizHawk.Client.Common.DisplayType _displayType = BizHawk.Client.Common.DisplayType.Unsigned;

                    bool   _bigEndian = Convert.ToBoolean(disassembleCheat[4]);
                    byte[] _value     = disassembleCheat[5].Split(',').Select(it => Convert.ToByte(it)).ToArray();
                    bool   _isEnabled = Convert.ToBoolean(disassembleCheat[6]);
                    bool   _isFreeze  = Convert.ToBoolean(disassembleCheat[7]);

                    bl.Layer.Add(new BlastCheat(_domain, _address, _displayType, _bigEndian, _value, _isEnabled, _isFreeze));
                }
            }

            bl.Layer.AddRange(RTC_PipeEngine.AllBlastPipes);

            string thisSystem  = Global.Game.System;
            string romFilename = GlobalWin.MainForm.CurrentlyOpenRom;

            var rp = RTC_MemoryDomains.GetRomParts(thisSystem, romFilename);

            if (rp.error == null)
            {
                if (rp.primarydomain != null)
                {
                    List <byte> addData = new List <byte>();

                    if (rp.skipbytes != 0)
                    {
                        byte[] padding = new byte[rp.skipbytes];
                        for (int i = 0; i < rp.skipbytes; i++)
                        {
                            padding[i] = 0;
                        }

                        addData.AddRange(padding);
                    }

                    addData.AddRange(RTC_MemoryDomains.getDomainData(rp.primarydomain));
                    if (rp.seconddomain != null)
                    {
                        addData.AddRange(RTC_MemoryDomains.getDomainData(rp.seconddomain));
                    }

                    byte[] corrupted = addData.ToArray();
                    byte[] original  = File.ReadAllBytes(GlobalWin.MainForm.CurrentlyOpenRom);

                    if (RTC_MemoryDomains.MemoryInterfaces.ContainsKey("32X FB")) //Flip 16-bit words on 32X rom
                    {
                        original = original.FlipWords(2);
                    }
                    else if (thisSystem.ToUpper() == "N64")
                    {
                        original = BizHawk.Client.Common.RomGame.MutateSwapN64(original);
                    }
                    else if (GlobalWin.MainForm.CurrentlyOpenRom.ToUpper().Contains(".SMD"))
                    {
                        original = BizHawk.Client.Common.RomGame.DeInterleaveSMD(original);
                    }

                    for (int i = 0; i < rp.skipbytes; i++)
                    {
                        original[i] = 0;
                    }

                    BlastLayer romBlast = RTC_ExternalRomPlugin.GetBlastLayer(original, corrupted);

                    if (romBlast != null && romBlast.Layer.Count > 0)
                    {
                        bl.Layer.AddRange(romBlast.Layer);
                    }
                }
            }

            sk.BlastLayer = bl;
            RTC_Core.StartSound();

            return(sk);
        }