public DataProvider(EventHub hub, MemoryTracker memTracker, ISyncModelProvider client, IHashProvider hashProvider, DataOutput <SyncMesh> syncMeshOutput, DataOutput <SyncMaterial> syncMaterialOutput, DataOutput <SyncTexture> syncTextureOutput, DataOutput <StreamInstanceData> instanceDataOutput) { m_Hub = hub; m_MemTracker = memTracker; m_Client = client; m_HashProvider = hashProvider; m_SyncMaterialOutput = syncMaterialOutput; m_SyncMeshOutput = syncMeshOutput; m_SyncTextureOutput = syncTextureOutput; m_InstanceDataOutput = instanceDataOutput; m_DownloadRequests = new ConcurrentQueue <IStream>(); m_DownloadedInstances = new ConcurrentQueue <DownloadResult>(); m_DownloadedModels = new ConcurrentQueue <ObjectDownloadResult>(); m_StreamCaches = new Dictionary <StreamKey, StreamCache>(); m_InstanceCache = new Dictionary <StreamKey, StreamInstanceData>(); m_AddedModels = new HashSet <StreamKey>(); m_HubHandle = m_Hub.Subscribe <MemoryTrackerCacheCreatedEvent <Mesh> >(e => m_MeshesHandle = e.handle); }
public SyncModelConverter(EventHub hub, MemoryTracker memTracker, IOutput <SyncedData <TObject> > output) { m_Hub = hub; m_MemTracker = memTracker; m_Output = output; }
public virtual void Update() { try { RealTime.Update(); bool flag; LongEventHandler.LongEventsUpdate(out flag); if (flag) { this.destroyed = true; } else if (!LongEventHandler.ShouldWaitForEvent) { Rand.EnsureStateStackEmpty(); SteamManager.Update(); PortraitsCache.PortraitsCacheUpdate(); this.uiRoot.UIRootUpdate(); if (Time.frameCount > 3 && !Root.prefsApplied) { Root.prefsApplied = true; Prefs.Apply(); } this.soundRoot.Update(); MemoryTracker.Update(); } } catch (Exception e) { Log.Notify_Exception(e); throw; } }
public void InitTrackers() { m_PositionXTracker = GetT(MemoryAddresses.PlayerXPosition); m_PositionYTracker = GetT(MemoryAddresses.PlayerYPosition); m_TalkTrackerA = GetT(MemoryAddresses.TalkingA); m_TalkTrackerB = GetT(MemoryAddresses.TalkingB); }
void TestAll() { foreach (KeyValuePair <string, ICommand> item in tests) { MemoryTracker.Start(); string[] args = new string[1]; args[0] = item.Key; item.Value.Execute(args); MemoryTracker.Finish(); } }
void UpdateSubInfo(MemoryData data) { subMgr.CPIText.ChangeText(data.CPI.ToString()); var date = MemoryTracker.GetDate(data.date); subMgr.YearText.ChangeText(date.Year.ToString()); subMgr.MonText.ChangeText(date.Month.ToString()); subMgr.DayText.ChangeText(date.Day.ToString()); subMgr.DisplaySub(data.scene != 1); }
public virtual void Teardown() { //var errors = CryptoUtil.GetErrors(); //foreach (var err in errors) //{ // Console.WriteLine("ERROR: {0}", err); //} CollectionAssert.IsEmpty(MemoryTracker.Finish()); // CollectionAssert.IsEmpty(errors); }
public virtual void Update() { try { ResolutionUtility.Update(); RealTime.Update(); bool flag; LongEventHandler.LongEventsUpdate(out flag); if (flag) { this.destroyed = true; } else if (!LongEventHandler.ShouldWaitForEvent) { Rand.EnsureStateStackEmpty(); Widgets.EnsureMousePositionStackEmpty(); SteamManager.Update(); PortraitsCache.PortraitsCacheUpdate(); AttackTargetsCache.AttackTargetsCacheStaticUpdate(); Pawn_MeleeVerbs.PawnMeleeVerbsStaticUpdate(); Storyteller.StorytellerStaticUpdate(); CaravanInventoryUtility.CaravanInventoryUtilityStaticUpdate(); this.uiRoot.UIRootUpdate(); if (Time.frameCount > 3 && !Root.prefsApplied) { Root.prefsApplied = true; Prefs.Apply(); } this.soundRoot.Update(); try { MemoryTracker.Update(); } catch (Exception arg) { Log.Error("Error in MemoryTracker: " + arg, false); } try { MapLeakTracker.Update(); } catch (Exception arg2) { Log.Error("Error in MapLeakTracker: " + arg2, false); } } } catch (Exception arg3) { Log.Error("Root level exception in Update(): " + arg3, false); } }
public InstanceConverter(EventHub hub, MemoryTracker memTracker, Transform root, bool generateSourceRoots, IMaterialCache materialCache, IMeshCache meshCache, ISyncLightImporter lightImporter, DataOutput <GameObject> output) { m_Hub = hub; m_MemTracker = memTracker; m_MaterialCache = materialCache; m_MeshCache = meshCache; m_Output = output; m_SyncLightImporter = lightImporter; m_Originals = new Dictionary <StreamKey, OriginalInstance>(); m_Root = root; m_SourceRoots = generateSourceRoots ? new Dictionary <string, Transform>() : null; m_SyncObjects = new Dictionary <StreamKey, SyncObject>(); m_Instances = new Dictionary <StreamKey, SyncObjectBinding>(); m_HubGroup = m_Hub.CreateGroup(); m_Hub.Subscribe <PeriodicMemoryEvent>(m_HubGroup, OnPeriodicMemoryEvent); m_Hub.Subscribe <MemoryTrackerCacheCreatedEvent <Mesh> >(m_HubGroup, e => m_MeshesHandle = e.handle); }
void Run(string[] args) { if (args.Length == 0) { Usage(); return; } if (args[0] == "all") { TestAll(); return; } ICommand cmd; if (!this.tests.TryGetValue(args[0], out cmd)) { Usage(); return; } // Check to see if "fips" is an argument, if so, set FIPS mode // here (before any other calls to the crypto lib) foreach (string arg in args) { if (arg.ToLower() == "fips") { Console.WriteLine("Executing test in FIPS mode."); FIPS.Enabled = true; break; } } MemoryTracker.Start(); cmd.Execute(args); MemoryTracker.Finish(); }
public Computer(Guid id) { m_guid = id; m_on = false; m_host = null; m_output = TextWriter.Null; m_errorOutput = TextWriter.Null; m_memory = new MemoryTracker(0, delegate() { foreach (var device in m_devices) { device.FreeUnusedMemory(); } }); m_ports = new PortCollection(); m_devices = new DeviceCollection(); m_eventQueue = new EventQueue(); m_powerStatus = PowerStatus.Fixed; m_chargeLevel = 1.0f; }
private void Form1_Load(object sender, EventArgs e) { SessionData.Memory = new MemoryTools(); SessionData.Memory.OnMemoryChanged += OnMemoryChanged; SessionData.Memory.CheckForNewDump(); SessionData.Bot = new PokemonRedBot(); SessionData.Bot.InitTrackers(); m_TalkTrackerA = SessionData.Memory.GetTracker(MemoryAddresses.TalkingA); m_TalkTrackerB = SessionData.Memory.GetTracker(MemoryAddresses.TalkingB); m_MapIDTracker = SessionData.Memory.GetTracker(MemoryAddresses.CurrentMapID); m_SpriteData = new BindingList <SpriteSetData>(); for (int i = 0; i < 16; i++) { m_SpriteData.Add(new SpriteSetData(i)); } list_Sprites.DataSource = m_SpriteData; StartWRAMListener(); VBAController.BringToFront(); }
public ServiceContainer(HelperContainer.Proxy helpers) { eventHub = new EventHub(); memoryTracker = new MemoryTracker(helpers.clock); }
public MeshConverter(EventHub hub, MemoryTracker memTracker, IOutput <SyncedData <Mesh> > output) : base(hub, memTracker, output) { m_MeshImporter = new SyncMeshImporter(); }
public URPMaterialConverter(EventHub hub, MemoryTracker memTracker, ITextureCache textureCache, IOutput <SyncedData <Material> > output, IReflectMaterialConverter converter) : base(hub, memTracker, textureCache, output) { ReflectMaterialManager.RegisterConverter(converter); }
public LuaPalette(Palette palette, MemoryTracker memory, bool readOnly = false) { Palette = palette; m_memory = memory; ReadOnly = readOnly; }
public virtual void Teardown() { MemoryTracker.Finish(); Assert.AreEqual(0, MemoryTracker.Leaked); }
public virtual void Setup() { MemoryTracker.Start(); }
public SampleMaterialConverter(EventHub hub, MemoryTracker memTracker, ITextureCache textureCache, IOutput <SyncedData <Material> > output, Shader opaqueShader, Shader transparentShader) : base(hub, memTracker, textureCache, output) { m_OpaqueShader = opaqueShader; m_TransparentShader = transparentShader; }
public static Image Decode(Stream stream, MemoryTracker memory, out Palette o_palette) { var reader = new BinaryReader(stream); // Read the header int imageIDLength = reader.ReadByte(); int colorMapType = reader.ReadByte(); int imageType = reader.ReadByte(); int colorMapStart = reader.ReadUInt16(); int colorMapLength = reader.ReadUInt16(); int colorMapBitsPerPixel = reader.ReadByte(); reader.ReadUInt16(); // xOffset reader.ReadUInt16(); // yOffset int width = reader.ReadUInt16(); int height = reader.ReadUInt16(); int bitsPerPixel = reader.ReadByte(); int imageDescriptor = reader.ReadByte(); if (bitsPerPixel != 8 || width == 0 || height == 0 || colorMapType != 1 || (colorMapStart + colorMapLength) == 0 || (colorMapStart + colorMapLength) > 256 || (colorMapBitsPerPixel != 24 && colorMapBitsPerPixel != 32) || (imageType != 1 && imageType != 9)) { throw new IOException("Unsupported TGA file"); } // Read the ID if (imageIDLength > 0) { reader.ReadBytes(imageIDLength); } // Read the color map int colorMapBytesPerPixel = colorMapBitsPerPixel / 8; var colorMap = reader.ReadBytes(colorMapLength * colorMapBytesPerPixel); var colors = new uint[colorMapStart + colorMapLength]; for (int i = 0; i < colors.Length; ++i) { if (i < colorMapStart) { colors[i] = 0x000000ff; } else { uint b = colorMap[(i - colorMapStart) * colorMapBytesPerPixel]; uint g = colorMap[(i - colorMapStart) * colorMapBytesPerPixel + 1]; uint r = colorMap[(i - colorMapStart) * colorMapBytesPerPixel + 2]; colors[i] = (r << 24) + (g << 16) + (b << 8) + 0xff; } } var palette = new Palette(colors); // Decode the image long size = width * height; if (palette != null) { size += 3 * palette.Size; } if (!memory.Alloc(size)) { throw new OutOfMemoryException(); } try { // Read the pixels byte[] buffer; bool rle = (imageType >= 8); if (rle) { // RLE buffer = new byte[width * height]; int pos = 0; while (pos < buffer.Length) { byte b = reader.ReadByte(); if (((int)b & 0x80) == 0x80) { // Run-length packet int count = ((int)b & 0x7f) + 1; byte value = reader.ReadByte(); int limit = Math.Min(pos + count, buffer.Length); while (pos < limit) { buffer[pos++] = value; } } else { // Non-run-length packet int count = ((int)b & 0x7f) + 1; int limit = Math.Min(pos + count, buffer.Length); while (pos < limit) { buffer[pos++] = reader.ReadByte(); } } } } else { // Non RLE buffer = reader.ReadBytes(width * height); } // Create the image bool flipY = (imageDescriptor & 0x20) == 0; var image = new Image(width, height); if (flipY) { for (int y = 0; y < height; ++y) { int flippedY = height - 1 - y; image.Write(buffer, y * width, width, 0, flippedY); } } else { image.Write(buffer, 0, width * height, 0, 0); } o_palette = palette; return(image); } catch { memory.Free(size); throw; } }
public TextureConverter(EventHub hub, MemoryTracker memTracker, IOutput <SyncedData <Texture2D> > output) : base(hub, memTracker, output) { m_TextureImporter = new SyncTextureImporter(); }
void Update() { //從第一個場景開始 且是伺服器模式 if (!isClient) { return; } if (ProcessManager.Instance == null || ProcessManager.Instance.Process == null) { return; } MemoryData newData = MemoryTracker.GetData(); bool isSel = newData.scene == 1; int targetNum = 0; //玩家數量 if (isSel) { targetNum = newData.sel_player_num; } else { targetNum = newData.player_num; } if (data.Comparer(newData)) { //Hack //修正出魔法屋物價亂跳的問題 if (newData.scene == 7) { HackManager.Instance.blockChangeCPI = true; } if (newData.cur < data.cur) { if (HackManager.Instance.isRandomCPI) { if (newData.scene > 1) { if (HackManager.Instance.blockChangeCPI) { HackManager.Instance.blockChangeCPI = false; } else { if (newData.total == 0) { HackManager.Instance.ResetProgressiveCPI(); } HackManager.Instance.RefreshRealCPI(newData); int cpi = HackManager.Instance.CalcBalanceCPI(); newData.CPI = cpi; ProcessUtility.WriteMem(ProcessManager.Instance.Process, MemoryTracker.GetPtr(MemoryTracker.MemTypeEnum.CPI), cpi); } } } } if (HackManager.Instance.isDecember) { var date = MemoryTracker.GetDate(newData.date); if (date.Month != 12) { byte mon = 12; ProcessUtility.WriteMem(ProcessManager.Instance.Process, MemoryTracker.GetPtr(MemoryTracker.MemTypeEnum.date + 1), mon); } } //代款修正 if (HackManager.Instance.isDecember || HackManager.Instance.isDecreaseLoanDate) { if (data.scene > 1) { for (int i = 0; i < 4; i++) { if (newData.loanDate[i] != data.loanDate[i] && newData.loanDate[i] != 0) { var newDate = MemoryTracker.GetDate(newData.loanDate[i]); HackManager.Instance.GetNewLoanDate(ref newDate); int convertedDate = MemoryTracker.ConvertDate(newDate); ProcessUtility.WriteMem(ProcessManager.Instance.Process, MemoryTracker.GetPtr(MemoryTracker.MemTypeEnum.p1_loanDay + i * MemoryTracker.sub_p), convertedDate); newData.loanDate[i] = convertedDate; } } } } //Send To Receiver CmdRead(targetNum, newData); data = newData; } }
public MaterialConverter(EventHub hub, MemoryTracker memTracker, ITextureCache textureCache, IOutput <SyncedData <Material> > output) : base(hub, memTracker, output) { m_Importer = new SyncMaterialImporter(); m_TextureCache = textureCache; }
public InstanceConverter(EventHub hub, MemoryTracker memTracker, Transform root, bool generateSourceRoots, IMaterialCache materialCache, IMeshCache meshCache, DataOutput <GameObject> output) : this(hub, memTracker, root, generateSourceRoots, materialCache, meshCache, null, output) { }
public LuaBuffer(Buffer buffer, MemoryTracker memory) { Buffer = buffer; m_memory = memory; }
public LuaImage(Image image, MemoryTracker memory, bool readOnly = false) { Image = image; m_memory = memory; ReadOnly = readOnly; }