private void CATabStackViewer_Load(object sender, EventArgs e) { StackEngine stackEngine = iPlugin.StackEngine; try { StackEngineProgressDialog.ReconstructStack(stackEngine); } catch (Exception exception) { iLbl_ErrorMessage.Text = exception.Message; iLbl_ErrorMessage.Visible = true; } iStackViewer.StackData = stackEngine.DataOutput; // Work out if we have any ghosts in the data - this dictates whether // or not we show the "hide ghosts" checkbox. bool seenGhost = false; foreach (StackOutputEntry entry in stackEngine.DataOutput) { if (entry.IsGhost) { seenGhost = true; break; } } // iCB_HideGhosts.Checked = seenGhost; iCB_HideGhosts.Visible = seenGhost; iStackViewer.OnlyShowEntriesWithSymbols = iCB_MatchExactSymbols.Checked; iStackViewer.HideGhosts = iCB_HideGhosts.Checked; }
private void StackEngine_EventHandler(StackEngine.TEvent aEvent, StackEngine aEngine) { if (aEvent == StackEngine.TEvent.EStackBuildingComplete) { iIsReady = true; } }
public Console(StackEngine engine) { Control = new ConsoleControl(engine, OnMessageSent, OnKeyUp); WriteLine("Welcome to STACK ENGINE"); Commands = LoadCommands(engine); Engine = engine; }
internal StackEnginePrimer(StackEngine aEngine) : base(aEngine.DataSource) { iEngine = aEngine; // base.LineNotHandled += new DataBufferPrimerUnhandledLine(StackEnginePrimer_LineNotHandled); base.PrimerComplete += new DataBufferPrimerCompleteHandler(StackEnginePrimer_PrimerComplete); }
/// <summary> /// Uses reflection to create instances for each class implementing IConsoleCommand. /// </summary> IEnumerable <IConsoleCommand> LoadCommands(StackEngine engine) { var InterfaceType = typeof(IConsoleCommand); return(AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => x.GetTypes()) .Where(x => InterfaceType.IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract) .Select(x => (IConsoleCommand)Activator.CreateInstance(x, engine))); }
public void DepthTest() { List <string> input = new List <string>(File.ReadAllLines("Stacks/input-3.txt")); List <string> expected = new List <string>(File.ReadAllLines("Stacks/output-3.txt")); StackEngine engine = new StackEngine(); List <string> output = engine.Transform(input); CollectionAssert.AreEqual(expected, output); }
internal StackPrefixManager(StackEngine aEngine) { iEngine = aEngine; // PreparePrefixes_CodeSegment(); PreparePrefixes_Pointer(); // iParserEntries.Add(iPrefixEngine_Pointer); iParserEntries.Add(iPrefixEngine_CodeSegment); }
public StackAlgorithmManager(StackEngine aEngine) { iEngine = aEngine; // Make the view name based upon the stack address range AddressRange range = aEngine.AddressInfo.Range; StringBuilder viewName = new StringBuilder(); viewName.AppendFormat("StackReconstructor_{0}_{1}", range, DateTime.Now.Ticks); iView = iEngine.DebugEngine.CreateView(viewName.ToString(), iEngine.CodeSegments); }
private void StackEngine_ExceptionHandler(Exception aException, StackEngine aEngine) { // Operation failed, but we must mark ourselves as ready or else UI clients will block forever... IsReady = true; // We'll deal with the public exceptions ourselves. Any kind of exception we cannot handle // will just get treated as a generic error. string msg = string.Empty; bool recognized = false; // if (aException is StackAddressException) { recognized = true; StackAddressException exception = (StackAddressException)aException; switch (exception.Type) { case StackAddressException.TType.ETypePointerIsNull: msg = LibResources.CIStackBuilder_AddressInfoException_PointerMissing; break; case StackAddressException.TType.ETypePointerOutOfBounds: msg = LibResources.CIStackBuilder_AddressInfoException_PointerOutOfBounds; break; case StackAddressException.TType.ETypeBaseAddressBeforeTopAddress: msg = LibResources.CIStackBuilder_AddressInfoException_BaseAddressBeforeTopAddress; break; case StackAddressException.TType.ETypeTopAddressAfterBaseAddress: msg = LibResources.CIStackBuilder_AddressInfoException_TopAddressAfterBaseAddress; break; default: recognized = false; break; } } // Not recognized? Unfortunately have to leak the original underlying .NET exception details if (recognized == false) { msg = aException.Message; } if (string.IsNullOrEmpty(msg) == false) { // Treat exceptions as fatal errors CIMessageError error = new CIMessageError(iStack.Container, LibResources.CIStackBuilder_Error_Title); error.AddLine(msg); iStack.AddChild(error); } }
public Menu(StackEngine engine) { FocusSound = engine.EngineContent.Load <SoundEffect>(content.audio.menu_click); ClickSound = engine.EngineContent.Load <SoundEffect>(content.audio.menu_focus); MenuSong = engine.EngineContent.Load <Song>(content.audio.menu); Engine = engine; GameSettings = engine.GameSettings; MediaPlayer.Volume = MathHelper.Clamp(GameSettings.MusicVolume, 0.0f, 1.0f); if (!AudioManager.SoundDisabled) { MediaPlayer.Play(MenuSong); } MediaPlayer.IsRepeating = true; var GUI = engine.Renderer.GUIManager; var Cursor = CreateCursor(); GUI.ShowSoftwareCursor = true; GUI.Skin.Cursors["Default"].Resource = Cursor; GUI.SetCursor(Cursor); MainMenuBackground = new ImageBox(GUI); // Imagebox showing the image MainMenuBackground.Init(); MainMenuBackground.SizeMode = SizeMode.Stretched; MainMenuBackground.Width = engine.Renderer.DisplaySettings.VirtualResolution.X; MainMenuBackground.Height = engine.Renderer.DisplaySettings.VirtualResolution.Y; MainMenuLabel = new Label(GUI); MainMenuLabel.Init(); MainMenuLabel.Text = string.Empty; MainMenuLabel.TextColor = Color.Black; MainMenuLabel.Parent = MainMenuBackground; MainMenuLabel.Width = engine.Renderer.DisplaySettings.VirtualResolution.X - 12; MainMenuLabel.Height = 24; MainMenuLabel.Left = 6; MainMenuLabel.Top = engine.Renderer.DisplaySettings.VirtualResolution.Y - MainMenuLabel.Height; AddExitConfirmationWindow(GUI); AddLoadGameWindow(GUI); AddSaveGameWindow(GUI); AddSettingsWindow(GUI); AddCreditsWindow(GUI); RefreshSaveGames(); InitMenuButtons(GUI); GUI.Add(MainMenuBackground); ShowLogo(true); }
private void PrimeStackEngine() { // Create new engine (resets old data) iStackEngine = new StackEngine(iInfo.CrashDebugger.DebugEngine); // Not yet ready iIsReady = false; // Get the data source DThread thread = iInfo.Info.Thread; string threadName = thread.Name.ToLower(); // DataBuffer dataSource = iInfo.Data; if (dataSource.Count > 0) { // Prime stack engine with data & current stack pointer iStackEngine.Primer.Prime(dataSource); iStackEngine.AddressInfo.Pointer = iInfo.Info.StackPointer; // Set us up so we know when the process finishes iStackEngine.EventHandler += new StackEngine.StackEngineEventHandler(StackEngine_EventHandler); // Set up registers. First update them taking into account the // curent CPU regs. RegisterCollection.TType requiredType = RegisterCollection.TType.ETypeUser; if (iInfo.Info.Type == ThreadStackInfo.TType.ETypeSupervisor) { requiredType = RegisterCollection.TType.ETypeSupervisor; } RegisterCollection registers = thread.NThread.GetRegisters(requiredType); iStackEngine.Registers = registers; // Get code segs DProcess process = thread.OwningProcess; if (process != null) { iStackEngine.CodeSegments = process.GetCodeSegDefinitions(); } } else { } }
public ConsoleControl(StackEngine engine, ConsoleMessageEventHandler messageSent, KeyEventHandler keyUp) { Manager = engine.Renderer.GUIManager; WindowUIControl = new TomShane.Neoforce.Controls.Window(Manager); WindowUIControl.Init(); WindowUIControl.Text = "STACK Engine Console"; WindowUIControl.Width = 480; WindowUIControl.Resizable = true; WindowUIControl.MinimumHeight = 240; WindowUIControl.MinimumWidth = 320; WindowUIControl.Height = 200; WindowUIControl.IconVisible = false; WindowUIControl.Alpha = 215; WindowUIControl.CloseButtonVisible = false; WindowUIControl.Closing += (object sender, WindowClosingEventArgs e) => e.Cancel = true; WindowUIControl.Visible = false; WindowUIControl.Color = Color.Black; WindowUIControl.Center(engine.Game.VirtualResolution); ConsoleUIControl = new TomShane.Neoforce.Controls.Console(Manager); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.System, "System", Color.White)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Debug, "Debug", Color.LightGray)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Error, "Error", Color.IndianRed)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Notice, "Notice", Color.DimGray)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Warning, "Warning", Color.DeepPink)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.User, "User", Color.Gray)); ConsoleUIControl.SelectedChannel = (byte)Console.Channel.User; ConsoleUIControl.ChannelsVisible = false; ConsoleUIControl.ClientArea.Left = 10; ConsoleUIControl.Color = Color.Black; ConsoleUIControl.MessageFormat = ConsoleMessageFormats.TimeStamp; ConsoleUIControl.TextBox.Color = Color.Black; ConsoleUIControl.Sender = "User"; ConsoleUIControl.TextBox.KeyUp += keyUp; ConsoleUIControl.TextBox.AutoSelection = false; ConsoleUIControl.Width = WindowUIControl.ClientWidth - ConsoleUIControl.Left; ConsoleUIControl.Height = WindowUIControl.ClientHeight; ConsoleUIControl.Parent = WindowUIControl; ConsoleUIControl.MessageSent += messageSent; WindowUIControl.Resize += new ResizeEventHandler(OnWindowResize); Manager.Add(WindowUIControl); }
public void EngineLoadsWorldComponentStates() { using (var GraphicsDevice = Mock.CreateGraphicsDevice()) using (var Engine = new StackEngine(StackGame.Empty, Mock.Wrap(GraphicsDevice), Mock.Input, GameSettings.LoadFromConfigFile(""))) { var Bytes1 = State.Serialization.SaveState(Engine.Game.World); var SaveGame1 = new STACK.SaveGame("TestSave", Bytes1, null); Engine.Game.World.Get <Camera>().Zoom = 2f; var Bytes2 = State.Serialization.SaveState(Engine.Game.World); var SaveGame2 = new STACK.SaveGame("TestSave", Bytes2, null); Engine.LoadState(SaveGame1); Assert.AreEqual(1f, Engine.Game.World.Get <Camera>().Zoom); Engine.LoadState(SaveGame2); Assert.AreEqual(2f, Engine.Game.World.Get <Camera>().Zoom); } }
public CIStackBuilder(CIStack aStack, DbgEngine aDebugEngine) { iStack = aStack; iStackEngine = new StackEngine(aDebugEngine); iStackEngine.AddressInfo.Pointer = aStack.PointerValue; iStackEngine.AddressInfo.Range = aStack.Range; iStackEngine.Registers = aStack.Registers; iStackEngine.DataSource = aStack.RawSourceData; // Get the code segments for the process bool isThreadStack = aStack.IsThreadAvailable; if (isThreadStack) { CIProcess process = OwningProcess; System.Diagnostics.Debug.Assert(process != null); // Seed stack engine with relevant code segments iStackEngine.CodeSegments = process.CodeSegments; } }
public SetCommand(StackEngine game) { Engine = game; }
private void StackEngine_MessageHandler(StackEngine.TMessageType aType, string aMessage, StackEngine aEngine) { switch (aType) { default: break; case StackEngine.TMessageType.ETypeError: { CIMessageError error = new CIMessageError(iStack.Container, LibResources.CIStackBuilder_Error_Title); error.AddLine(aMessage); iStack.AddChild(error); break; } case StackEngine.TMessageType.ETypeWarning: { CIMessageWarning warning = new CIMessageWarning(iStack.Container, LibResources.CIStackBuilder_Warning_Title); warning.AddLine(aMessage); iStack.AddChild(warning); break; } } }
public ScreenshotCommand(StackEngine game) { Engine = game; }
public ExitCommand(StackEngine game) { Engine = game; }
public CAPluginRawStack(CAEngine aEngine) : base(aEngine, KPluginName) { iStackEngine = new StackEngine(aEngine.DebugEngine); }
public HelpCommand(StackEngine game) { Engine = game; }
public ResumeCommand(StackEngine game) { Engine = game; }