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; 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 { } }
public GameInfo() { Dictionary <string, object> gameInfo = gameInfos[0]; if (gameInfos.ContainsKey(Util.Version)) { gameInfo = gameInfos[Util.Version]; } string process_name = (string)gameInfo["process_name"]; string section_name = (string)gameInfo["section_name"]; ulong id_offset = Convert.ToUInt64(gameInfo["id_offset"]); ulong version_offset = Convert.ToUInt64(gameInfo["version_offset"]); int section_prot = Convert.ToInt32(gameInfo["section_prot"]); try { ProcessManager processManager = new ProcessManager(); ProcessInfo processInfo = processManager.GetProcessInfo(process_name); MemoryHelper memoryHelper = new MemoryHelper(false, processInfo.pid); MappedSectionList mappedSectionList = processManager.MappedSectionList; mappedSectionList.InitMemorySectionList(MemoryHelper.GetProcessMaps(processInfo.pid)); 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 { } }