private Hashing.Hash128 GetModelHash(string model) { return(_modelHash.GetOrAdd(model, (modelPath) => { var hb = Hashing.Builder(); if (!Buffers.TryTake(out var buffer)) { buffer = new byte[1024]; } using (var stream = OpenModelReader(modelPath)) { while (true) { var count = stream.Read(buffer, 0, buffer.Length); if (count <= 0) { break; } for (var i = 0; i < count; i++) { hb.Add(buffer[i]); } } } Buffers.Add(buffer); var hash = hb.Build(); if (DebugFlags.Debug(typeof(DerivedModelManager))) { _log.Info($"Generated model hash for {model} = {hash}"); } return hash; }));
internal Endpoint(String name) : base(name) { Flags = DebugFlags._None; ActiveMode = ImportPipeline.ActiveMode.Lazy | ImportPipeline.ActiveMode.Global; CloseMode = ImportPipeline.CloseMode.Normal; }
public Endpoint (ImportEngine engine, XmlNode node, ImportPipeline.ActiveMode defActiveMode=0) : base(node) { Engine = engine; if (defActiveMode == 0) defActiveMode = ImportPipeline.ActiveMode.Lazy | ImportPipeline.ActiveMode.Global; if ((defActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global)) != 0) defActiveMode |= ImportPipeline.ActiveMode.Global; Flags = node.ReadEnum<DebugFlags>("@flags", 0); CloseMode = node.ReadEnum("@closemode", CloseMode.Normal); ActiveMode = node.ReadEnum("@active", defActiveMode); switch (ActiveMode) { case 0: ActiveMode = defActiveMode; break; case ImportPipeline.ActiveMode.False: case ImportPipeline.ActiveMode.True: break; default: if ((ActiveMode & (ImportPipeline.ActiveMode.False | ImportPipeline.ActiveMode.True)) != 0) throw new BMNodeException (node, "ActiveMode true/false cannot be combined with other flags. ActiveMode={0}.", ActiveMode); if ((ActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global)) != 0) ActiveMode |= defActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global); break; } }
internal static void Ping(DebugFlags flag, string message) { if ((debugFlags & flag) == flag) { System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1); string name = sf.GetMethod().Name; System.Diagnostics.Debug.WriteLine(string.Format("Function: {0}, {1}\r\n", name, message)); } }
public void Debug(DebugFlags category, string message) { if (((int)category & (int)flags) == 0) { return; } DoWriteLine(message); }
private void CheckDebugRequests() { var state = Microsoft.Xna.Framework.Input.Keyboard.GetState(); if (CanAcceptDebug) { var dDown = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D); if (!dDown) { return; } var one = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D1); var two = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D2); var three = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D3); var four = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D4); var five = state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D5); var toFlip = DebugFlags.None; if (one) { toFlip |= DebugFlags.SpriteBoundingBoxes; } if (two) { toFlip |= DebugFlags.HitMapBoundingBoxes; } if (three) { toFlip |= DebugFlags.HitMapPolygons; } if (four) { toFlip |= DebugFlags.SystemTimings; } if (five) { toFlip |= DebugFlags.FramesPerSecond; } DebugSettings ^= toFlip; CanAcceptDebug = false; } else { var dUp = state.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.D); if (dUp) { CanAcceptDebug = true; } } }
protected virtual void RemoveExtraModifiers(long dt) { if (Entity == null || !Entity.InScene) { return; } using (Lock.AcquireExclusiveUsing()) { using (PoolManager.Get(out List <TRtKey> toRemove)) { foreach (var id in Modifiers.Keys) { if (!KeyExists(in id)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } Modifiers.Remove(rem); } } using (PoolManager.Get(out List <ModifierDataKey> toRemove)) { foreach (var id in ModifierData.Keys) { if (!KeyExists(in id.Host)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } ModifierData.Remove(rem); } } } }
/// <summary> /// This overload assumes there is a single callback /// </summary> public static void InitializeDebug(DebugFlags flags, DebugMode mode, DebugCallback?callback) { if (callback is null) { InitializeDebug(flags, mode, null, null); } else { DebugCallbackReference = callback; delegate * unmanaged <DebugFlags, byte *, int, byte *, byte *, Result> callbackPointer = &DebugCallbackMarshaller; InitializeDebug(flags, mode, callbackPointer, null); } }
public ReportWriter(string file, DebugFlags flags) { this.file = file; this.flags = flags; if (file != null) { writer = new StreamWriter(file, true); } else { writer = new StreamWriter(Console.OpenStandardError()); } writer.AutoFlush = true; }
protected void RemoveExtraModifiers() { using (Lock.AcquireExclusiveUsing()) { using (PoolManager.Get(out List <TRtKey> toRemove)) { foreach (var id in Modifiers.Keys) { if (!TryCreateContext(in id, InterningBag <EquiModifierBaseDefinition> .Empty, out _)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } Modifiers.Remove(rem); } } using (PoolManager.Get(out List <ModifierDataKey> toRemove)) { foreach (var id in ModifierData.Keys) { if (!TryCreateContext(in id.Host, InterningBag <EquiModifierBaseDefinition> .Empty, out _)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } ModifierData.Remove(rem); } } } }
private static Result DebugCallbackMarshaller(DebugFlags flags, byte *file, int line, byte *func, byte *message) { if (DebugCallbackReference is null) { return(Result.Ok); } try { var fileString = FmodHelpers.PtrToStringUnknownSize(file); var funcString = FmodHelpers.PtrToStringUnknownSize(func); var messageString = FmodHelpers.PtrToStringUnknownSize(message); return(DebugCallbackReference.Invoke(flags, fileString, line, funcString, messageString)); } catch (FmodException fe) { return(fe.Result ?? Result.Err_Internal); } catch { return(Result.Err_Internal); } }
public static void Debug(DebugFlags category, object argument) { Debug(category, "{0}", argument); }
public static void Debug(DebugFlags category, string message, params object[] args) { string formatted = String.Format(message, args); ReportWriter.Debug(category, formatted); }
public static void InitializeDebug(DebugFlags flags, DebugMode mode, string?filename = null) { InitializeDebug(flags, mode, null, filename); }
/// <inheritdoc cref="FmodLibrary.Debug_Initialize(DebugFlags, DebugMode, delegate* unmanaged{DebugFlags, byte*, int, byte*, byte*, Result}, byte*)"/> public static void InitializeDebug(DebugFlags flags, DebugMode mode, delegate *unmanaged <DebugFlags, byte *, int, byte *, byte *, Result> callback, string?filename)
public static Result Initialize(DebugFlags flags, DebugMode mode, DebugCallback callback, string filename) { return(FMOD_Debug_Initialize(flags, mode, callback, filename)); }
public void EnableDebugFlags() { DebugFlags flags = DebugFlags.Lines | DebugFlags.Logging | DebugFlags.Strings; InteractionC.EnableDebugFlags(ref _scene, (uint)flags); }
public void Debug(DebugFlags category, string message) { if (((int) category & (int) flags) == 0) return; DoWriteLine (message); }
public static void Initialize(string file, DebugFlags flags) { writer = new ReportWriter(file, flags); }
public virtual void Step() { float timeStep = TestSettings.hz > 0.0f ? 1.0f / TestSettings.hz : 0.0f; if (TestSettings.pause) { if (TestSettings.singleStep) { TestSettings.singleStep = false; } else { timeStep = 0.0f; } } DebugFlags flags = 0; if (TestSettings.drawShapes) { flags |= DebugFlags.Shapes; } if (TestSettings.drawJoints) { flags |= DebugFlags.Joints; } if (TestSettings.drawAABBs) { flags |= DebugFlags.AABBs; } if (TestSettings.drawPairs) { flags |= DebugFlags.Pairs; } if (TestSettings.drawCOMs) { flags |= DebugFlags.CenterOfMasses; } m_debugDraw.Flags = flags; m_world.WarmStarting = TestSettings.enableWarmStarting; m_world.ContinuousPhysics = TestSettings.enableContinuous; m_pointCount = 0; m_world.Step(timeStep, TestSettings.velocityIterations, TestSettings.positionIterations); //m_world.DrawDebugData(); if (timeStep > 0.0f) { ++m_stepCount; } // Make a small box. _selectedFixture = null; { AABB aabb = new AABB(); Vec2 d = new Vec2(0.001f, 0.001f); var p2 = Main.CursorPos; var p = Program.MainForm.ConvertScreenToWorld((int)p2.X, (int)p2.Y); aabb.LowerBound = p - d; aabb.UpperBound = p + d; m_world.QueryAABB( delegate(Fixture fixture) { Body body = fixture.Body; if (body.BodyType == BodyType.Dynamic) { bool inside = fixture.TestPoint(p); if (inside) { _selectedFixture = fixture; // We are done, terminate the query. return(false); } } // Continue the query. return(true); }, aabb); } }
/* DEBUG */ /* ==================================================================*/ public static void SetDebug(DebugFlags flag) { Bgfx.set_debug((uint)flag); }
/// <summary> /// <para>Determines whether any of the specified <paramref name="flags"/> is enabled.</para> /// </summary> /// <param name="flags">The flags to test for.</param> /// <returns><see langword="true"/>, if any of the specified <paramref name="flags"/> is enabled; otherwise, <see langword="false"/>.</returns> public static bool IsDebugEnabled(DebugFlags flags) => (DebugFlags & flags) != 0;
private static extern void Node_debug(IntPtr node_reference, DebugFlags features);
public virtual void Debug(DebugFlags features = DebugFlags.SHOW_ALL) { Node_debug(GetNativeReference(), features); }
public static void Initialize(string file, DebugFlags flags) { writer = new ReportWriter (file, flags); }
public DebugFlagEvent(FlagOperation operation, DebugFlags flag) { Operation = operation; Flag = flag; }
private static extern Result FMOD_Debug_Initialize(DebugFlags flags, DebugMode mode, DebugCallback callback, string filename);
public static void Debug(DebugFlags category, string message, params object[] args) { string formatted = String.Format (message, args); ReportWriter.Debug (category, formatted); }
public static bool ParseDebugFlags(string value, out DebugFlags flags) { int int_flags = 0; if (Int32.TryParse(value, out int_flags)) { flags = (DebugFlags)int_flags; return(true); } flags = DebugFlags.None; foreach (string flag in value.Split(',')) { switch (flag) { case "jit": flags |= DebugFlags.JitSymtab; break; case "address": flags |= DebugFlags.MethodAddress; break; case "threads": flags |= DebugFlags.Threads; break; case "signals": flags |= DebugFlags.Signals; break; case "eventloop": flags |= DebugFlags.EventLoop; break; case "wait": flags |= DebugFlags.Wait; break; case "sse": flags |= DebugFlags.SSE; break; case "notification": flags |= DebugFlags.Notification; break; case "mutex": flags |= DebugFlags.Mutex; break; case "symtab": flags |= DebugFlags.SymbolTable; break; case "sources": flags |= DebugFlags.SourceFiles; break; case "dwarf": flags |= DebugFlags.DwarfReader; break; case "remoting": flags |= DebugFlags.Remoting; break; case "nunit": flags |= DebugFlags.NUnit; break; case "gui": flags |= DebugFlags.GUI; break; case "cli": flags |= DebugFlags.CLI; break; default: return(false); } } return(true); }
public static bool ParseDebugFlags(string value, out DebugFlags flags) { int int_flags = 0; if (Int32.TryParse (value, out int_flags)) { flags = (DebugFlags) int_flags; return true; } flags = DebugFlags.None; foreach (string flag in value.Split (',')) { switch (flag) { case "jit": flags |= DebugFlags.JitSymtab; break; case "address": flags |= DebugFlags.MethodAddress; break; case "threads": flags |= DebugFlags.Threads; break; case "signals": flags |= DebugFlags.Signals; break; case "eventloop": flags |= DebugFlags.EventLoop; break; case "wait": flags |= DebugFlags.Wait; break; case "sse": flags |= DebugFlags.SSE; break; case "notification": flags |= DebugFlags.Notification; break; case "mutex": flags |= DebugFlags.Mutex; break; case "symtab": flags |= DebugFlags.SymbolTable; break; case "sources": flags |= DebugFlags.SourceFiles; break; case "dwarf": flags |= DebugFlags.DwarfReader; break; case "remoting": flags |= DebugFlags.Remoting; break; case "nunit": flags |= DebugFlags.NUnit; break; case "gui": flags |= DebugFlags.GUI; break; case "cli": flags |= DebugFlags.CLI; break; default: return false; } } return true; }
public ReportWriter(string file, DebugFlags flags) { this.file = file; this.flags = flags; if (file != null) writer = new StreamWriter (file, true); else writer = new StreamWriter (Console.OpenStandardError ()); writer.AutoFlush = true; }
// Inject Modfall information into the log public static void Log(Exception e, bool whileLoading) { string text = ""; if (File.Exists(FILENAME)) { StreamReader streamReader = new StreamReader(FILENAME); text = streamReader.ReadToEnd(); streamReader.Close(); if (!text.Contains(">>>>>")) { text = ""; } } new StackTrace(e, true); string modList = ""; foreach (Mod mod in ModLoader.mm.ModLoader.Mods) { modList += $"{mod.Data.Name} v{mod.Data.Version}\r\n"; } string text2 = string.Concat(new string[] { "Ver ", Version.ToString(), "\r\n", "Modfall Ver ", ModLoader.mm.ModLoader.ModfallVersion.ToString(), "\r\n", "Mods Loaded", "\r\n", modList, "\r\n", "Time ", DateTime.Now.ToString(), "\r\n", DebugFlags.GetOutput(), "\r\n", e.ToString(), "\r\n" }); TextWriter textWriter = new StreamWriter(FILENAME, false); if (text == "") { textWriter.WriteLine("TowerFall Error Log"); textWriter.WriteLine("=========================================="); textWriter.WriteLine(">>>>>"); textWriter.WriteLine(); textWriter.Write(text2); } else { int num = text.IndexOf(">>>>>") + ">>>>>".Length; string str = text.Substring(0, num); string str2 = text.Substring(num); string text3 = text2; if (whileLoading) { text3 = "~LOADING ERROR~\r\n" + text3; } textWriter.Write(str + "\r\n\r\n" + text3 + str2); } textWriter.Close(); }
public virtual void Step() { float timeStep = TestSettings.hz > 0.0f ? 1.0f / TestSettings.hz : 0.0f; if (TestSettings.pause) { if (TestSettings.singleStep) { TestSettings.singleStep = false; } else { timeStep = 0.0f; } } DebugFlags flags = 0; if (TestSettings.drawShapes) { flags |= DebugFlags.Shapes; } if (TestSettings.drawJoints) { flags |= DebugFlags.Joints; } if (TestSettings.drawAABBs) { flags |= DebugFlags.AABBs; } if (TestSettings.drawPairs) { flags |= DebugFlags.Pairs; } if (TestSettings.drawCOMs) { flags |= DebugFlags.CenterOfMasses; } m_debugDraw.Flags = flags; m_world.WarmStarting = TestSettings.enableWarmStarting; m_world.ContinuousPhysics = TestSettings.enableContinuous; m_pointCount = 0; m_world.Step(timeStep, TestSettings.velocityIterations, TestSettings.positionIterations); //m_world.DrawDebugData(); if (timeStep > 0.0f) { ++m_stepCount; } // Make a small box. _selectedFixture = null; { AABB aabb = new AABB(); Vec2 d = new Vec2(0.001f, 0.001f); var p2 = Main.CursorPos; var p = Program.MainForm.ConvertScreenToWorld((int)p2.X, (int)p2.Y); aabb.LowerBound = p - d; aabb.UpperBound = p + d; m_world.QueryAABB( MouseQueryAABB, aabb); } }
public static void Debug(DebugFlags category, object argument) { Debug (category, "{0}", argument); }