Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- using XDevkit;
- using System.Diagnostics;
- namespace WindowsFormsApplication1
- {
- static class Program
- {
- public class Form1 : Form
- {
- public TextBox textBox1;
- static uint sprintfAddress = 0x82012F48;
- static IXboxManager xbm;
- static XboxConsole xboxConsole;
- public Form1()
- {
- InitializeComponent();
- }
- private void InitializeComponent()
- {
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.SuspendLayout();
- //
- // textBox1
- //
- this.textBox1.AcceptsReturn = true;
- this.textBox1.AcceptsTab = true;
- this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.textBox1.Multiline = true;
- this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- //
- // Form1
- //
- this.ClientSize = new System.Drawing.Size(284, 264);
- this.Controls.Add(this.textBox1);
- this.Text = "TextBox Example";
- this.ResumeLayout(false);
- this.PerformLayout();
- xbm = new XboxManager();
- xboxConsole = xbm.OpenConsole(xbm.DefaultConsole);
- xboxConsole.DebugTarget.SetBreakpoint(sprintfAddress);
- xboxConsole.OnStdNotify += new XboxEvents_OnStdNotifyEventHandler(MyStdNotifyHandler);
- }
- void MyStdNotifyHandler(XboxDebugEventType eventType, IXboxEventInfo eventInfo)
- {
- if (eventType != XboxDebugEventType.ExecutionBreak || eventInfo.Info.Address != sprintfAddress)
- {
- return;
- }
- try
- {
- Debug.WriteLine("Hit Function");
- long r4;
- IXboxStackFrame functionStack = eventInfo.Info.Thread.TopOfStack;
- functionStack.GetRegister64(XboxRegisters64.r4, out r4);
- byte[] buffer = new byte[128];
- uint outInfo;
- uint len = 128;
- xboxConsole.DebugTarget.GetMemory((uint)r4, len, buffer, out outInfo);
- Debug.WriteLine(buffer);
- }
- catch (Exception)
- {
- }
- finally
- {
- if (Convert.ToBoolean(eventInfo.Info.IsThreadStopped))
- {
- bool flag2;
- eventInfo.Info.Thread.Continue(true);
- xboxConsole.DebugTarget.Go(out flag2);
- xboxConsole.DebugTarget.FreeEventInfo(eventInfo.Info);
- }
- }
- return;
- }
- }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment