Esempio n. 1
0
        public void UpdateResultList(ProcessManager processManager, MemoryHelper memoryHelper,
                                     string default_value_0_str, string default_value_1_str, bool is_hex, bool newScan)
        {
            if (!Check)
            {
                ResultList = null;
                return;
            }

            ResultList new_result_list = new ResultList(memoryHelper.Length, memoryHelper.Alignment);

            ulong address      = this.Start;
            uint  base_address = 0;
            int   length       = this.Length;

            const int buffer_length = 1024 * 1024 * 128;

            while (length != 0)
            {
                int cur_length = buffer_length;

                if (cur_length > length)
                {
                    cur_length = length;
                    length     = 0;
                }
                else
                {
                    length -= cur_length;
                }

                byte[] buffer = memoryHelper.ReadMemory(address, (int)cur_length);

                byte[] default_value_0 = null;
                if (memoryHelper.ParseFirstValue)
                {
                    if (is_hex)
                    {
                        default_value_0 = memoryHelper.HexStringToBytes(default_value_0_str);
                    }
                    else
                    {
                        default_value_0 = memoryHelper.StringToBytes(default_value_0_str);
                    }
                }

                byte[] default_value_1 = null;
                if (memoryHelper.ParseSecondValue)
                {
                    if (is_hex)
                    {
                        default_value_1 = memoryHelper.HexStringToBytes(default_value_1_str);
                    }
                    else
                    {
                        default_value_1 = memoryHelper.StringToBytes(default_value_1_str);
                    }
                }

                if (newScan)
                {
                    memoryHelper.CompareWithMemoryBufferNewScanner(default_value_0, default_value_1, buffer, new_result_list, base_address);
                }
                else
                {
                    memoryHelper.CompareWithMemoryBufferNextScanner(default_value_0, default_value_1, buffer, ResultList, new_result_list);
                }

                address      += (ulong)cur_length;
                base_address += (uint)cur_length;
            }
            ResultList = new_result_list;
        }
Esempio n. 2
0
        public GameInfo()
        {
            string process_name   = "";
            string section_name   = "";
            ulong  id_offset      = 0;
            ulong  version_offset = 0;
            int    section_prot   = 0;

            switch (Util.Version)
            {
            case 405:
                process_name   = GAME_INFO_4_05_PROCESS_NAME;
                section_name   = GAME_INFO_4_05_SECTION_NAME;
                id_offset      = GAME_INFO_4_05_ID_OFFSET;
                version_offset = GAME_INFO_4_05_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_05_SECTION_PROT;
                break;

            case 455:
                process_name   = GAME_INFO_4_55_PROCESS_NAME;
                section_name   = GAME_INFO_4_55_SECTION_NAME;
                id_offset      = GAME_INFO_4_55_ID_OFFSET;
                version_offset = GAME_INFO_4_55_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_55_SECTION_PROT;
                break;

            case 505:
                process_name   = GAME_INFO_5_05_PROCESS_NAME;
                section_name   = GAME_INFO_5_05_SECTION_NAME;
                id_offset      = GAME_INFO_5_05_ID_OFFSET;
                version_offset = GAME_INFO_5_05_VERSION_OFFSET;
                section_prot   = GAME_INFO_5_05_SECTION_PROT;
                break;

            default:
                break;
            }

            try
            {
                ProcessManager processManager = new ProcessManager();
                ProcessInfo    processInfo    = processManager.GetProcessInfo(process_name);

                MemoryHelper      memoryHelper      = new MemoryHelper(false, processInfo.pid);
                MappedSectionList mappedSectionList = processManager.MappedSectionList;
                mappedSectionList.InitMemorySectionList(processInfo);
                List <MappedSection> sectionList = mappedSectionList.GetMappedSectionList(section_name, section_prot);

                if (sectionList.Count != 1)
                {
                    return;
                }

                GameID  = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + id_offset, 16));
                GameID  = GameID.Trim(new char[] { '\0' });
                Version = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + version_offset, 16));
                Version = Version.Trim(new char[] { '\0' });
            }
            catch
            {
            }
        }
Esempio n. 3
0
 public BatchCodeCheat(ProcessManager ProcessManager)
     : base(ProcessManager)
 {
     CheatType = CheatType.BATCH_CODE_TYPE;
     AllowLock = true;
 }
Esempio n. 4
0
 public BatchCodeCheat(CheatOperator source, CheatOperator dest, bool lock_, string description, ProcessManager processManager)
     : base(processManager)
 {
     CheatType   = CheatType.DATA_TYPE;
     AllowLock   = true;
     Source      = source;
     Destination = dest;
     Lock        = lock_;
     Description = description;
 }
Esempio n. 5
0
 public BatchCodeCheatOperator(List <BatchCode> Codes, CheatOperator Address, ValueType valueType, ProcessManager processManager)
     : base(valueType, processManager)
 {
     this.Address      = Address;
     this.Codes        = Codes;
     CheatOperatorType = CheatOperatorType.BATCH_CODE_TYPE;
 }