Guest User

hud elem help

a guest
Jul 27th, 2013
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10. using XRPCLib;
  11.  
  12. namespace HudE
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         XRPC Jtag = new XRPC();
  17.         Random rnd = new Random();
  18.         private static byte[] myBuffer = new byte[0x20];
  19.         Thread t;
  20.         public Form1()
  21.         {
  22.             InitializeComponent();
  23.         }
  24.  
  25.         #region HUD
  26.         public class gameAddresses
  27.         {
  28.             public static uint
  29.             locString = 0x82388668,
  30.             material = 0x82388A88,
  31.             elem = 0x83541618,
  32.             type = 0x6D,
  33.             xOffset = 0x0,
  34.             yOffset = 0x4,
  35.             textOffset = 0x62,
  36.             fontSizeOffset = 12,
  37.             colorOffset = 0x18,
  38.             relativeOffset = 0x72,
  39.             widthOffset = 0x58,
  40.             heightOffset = 90,
  41.             shaderOffset = 0x74,
  42.             alignOffset = 0x72,
  43.             clientOffset = 0x7C,
  44.             sortOffset = 0x20,
  45.             glowOffset = 0x44,
  46.             sort = 0x32;
  47.             public static float
  48.             fromX = 0,
  49.             fromY = 0,
  50.             fromAlignOrg = 0,
  51.             fromAlignScreen = 0;
  52.         }
  53.  
  54.         /*
  55.         public uint createElem(int client)
  56.         {
  57.             return Jtag.Call(gameAddresses.elem, client, 0);
  58.         }*/
  59.  
  60.  
  61.         public uint createElem(int client)
  62.         {
  63.             uint CreateElem = Jtag.Call(gameAddresses.elem, client, 0);
  64.             Jtag.SetMemory(CreateElem + 0x7C, ReverseBytes(BitConverter.GetBytes(client)));
  65.             return CreateElem;
  66.         }
  67.  
  68.         public uint spawnElem(int client, uint elemAddress)
  69.         {
  70.             Jtag.SetMemory(elemAddress + 0xA8, ReverseBytes(BitConverter.GetBytes(client)));
  71.  
  72.             return elemAddress;
  73.         }
  74.  
  75.         public uint createText(string text)
  76.         {
  77.             return Jtag.Call(gameAddresses.locString, text);
  78.         }
  79.  
  80.         public uint getMaterialIndex(string material)
  81.         {
  82.             return Jtag.Call(gameAddresses.material, material);
  83.         }
  84.  
  85.         public byte[] uintBytes(uint input)
  86.         {
  87.             byte[] data = BitConverter.GetBytes(input);
  88.             Array.Reverse(data);
  89.             return data;
  90.         }
  91.  
  92.         public byte[] ReverseBytes(byte[] inArray)
  93.         {
  94.             byte temp;
  95.             int highCtr = inArray.Length - 1;
  96.  
  97.             for (int ctr = 0; ctr < inArray.Length / 2; ctr++)
  98.             {
  99.                 temp = inArray[ctr];
  100.                 inArray[ctr] = inArray[highCtr];
  101.                 inArray[highCtr] = temp;
  102.                 highCtr -= 1;
  103.             }
  104.             return inArray;
  105.         }
  106.  
  107.         public void setIcon(int client, uint elem, uint shader, int width, int height, float x, float y, uint align, float sort = 0, int r = 84, int g = 84, int b = 84, int a = 215)
  108.         {
  109.             Jtag.SetMemory(elem + gameAddresses.clientOffset, ReverseBytes(BitConverter.GetBytes((byte)client)));
  110.             byte[] myelem = new byte[] {
  111.                 0x42, 0x48, 0x00, 0x00, 0x42, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00,
  112.                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
  113.                 0x00, 0x00, 0x00, 0x00, 0x29, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  114.                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  115.                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  116.                 0x00, 0x00, 0x01, 0x80, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x01, 0xF4, 0x00, 0x00, 0x00, 0x46,
  117.                 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  118.                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x21, 0x01, 0x00, 0x00, 0x00,
  119.                 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  120.                 0x00 };
  121.             Jtag.SetMemory(elem, myelem);
  122.             byte[] sorts = ReverseBytes(BitConverter.GetBytes(sort));
  123.             Jtag.SetMemory(elem + gameAddresses.sort, new byte[] { sorts[0], sorts[1] });
  124.             Jtag.SetMemory(elem + gameAddresses.relativeOffset, new byte[] { (byte)5 });
  125.             Jtag.SetMemory(elem + gameAddresses.relativeOffset + 1, new byte[] { (byte)align });
  126.             byte[] heights = BitConverter.GetBytes(height);
  127.             Jtag.SetMemory(elem + gameAddresses.heightOffset - 2, ReverseBytes(heights));
  128.             byte[] widths = BitConverter.GetBytes(width);
  129.             Jtag.SetMemory(elem + gameAddresses.widthOffset - 2, ReverseBytes(widths));
  130.             Jtag.SetMemory(elem + gameAddresses.shaderOffset, new byte[] { (byte)shader });
  131.             Jtag.SetMemory(elem + gameAddresses.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
  132.             Jtag.SetMemory(elem + gameAddresses.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
  133.             Jtag.SetMemory(elem + gameAddresses.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
  134.         }
  135.  
  136.         public void SetText(int client, uint elem, byte[] text, float fontScale, float x, float y, uint align, int r = 255, int g = 255, int b = 255, int a = 255, int GlowR = 255, int GlowG = 255, int GlowB = 255, int GlowA = 255)
  137.         {
  138.             Jtag.SetMemory(elem + 0x7c, ReverseBytes(BitConverter.GetBytes(client)));
  139.             //byte[] myelem = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x42, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x6B, 0x08, 0x00, 0x01, 0x80, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x64, 0xEA, 0x60, 0x03, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  140.             //remote.SetMemory(elem, myelem);
  141.             Jtag.SetMemory(elem + gameAddresses.type, new byte[] { 0x00, 0x00, 0x00, 0x01 });
  142.             Jtag.SetMemory(gameAddresses.sort + elem, new byte[] { (byte)0x0A, (byte)0xFF });
  143.             Jtag.SetMemory(elem + gameAddresses.textOffset, text);
  144.             Jtag.SetMemory(elem + gameAddresses.relativeOffset, new byte[] { (byte)5 });
  145.             Jtag.SetMemory(elem + gameAddresses.relativeOffset + 1, new byte[] { (byte)align });
  146.             Jtag.SetMemory(elem + gameAddresses.textOffset + 4, new byte[] { 0x40, 0x00 });
  147.             Jtag.SetMemory(elem + gameAddresses.fontSizeOffset, ReverseBytes(BitConverter.GetBytes(fontScale)));
  148.             Jtag.SetMemory(elem + gameAddresses.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
  149.             Jtag.SetMemory(elem + gameAddresses.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
  150.             Jtag.SetMemory(elem + gameAddresses.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
  151.             //remote.SetMemory(elem + gameAddresses.GlowColor, new byte[] { BitConverter.GetBytes(GlowR)[0], BitConverter.GetBytes(GlowG)[0], BitConverter.GetBytes(GlowB)[0], BitConverter.GetBytes(GlowA)[0] });
  152.         }
  153.  
  154.  
  155.         #endregion
  156.  
  157.         class Offsets
  158.         {
  159.             public static uint
  160.             SENDSERVERCOMMAND = 0x8242F958,
  161.             CBUF_ADDTEXT = 0x82401540;
  162.         }
  163.  
  164.         class Buttons
  165.         {
  166.             public static uint
  167.             LB = 256,
  168.             RB = 512,
  169.             RT = 128,
  170.             LT = 2147487744,
  171.             LS = 1088,
  172.             RS = 32,
  173.             Y = 134217728,
  174.             X = 4,
  175.             A = 8192,
  176.             B = 32768,
  177.             Allonger = 32768,
  178.             AllongerRS = 32800;
  179.         }
  180.  
  181.         float move = -40;
  182.         float Fx = 0;
  183.         private void Form1_Load(object sender, EventArgs e)
  184.         {
  185.  
  186.         }
  187.  
  188.         private void button2_Click(object sender, EventArgs e)
  189.         {
  190.             Jtag.Connect();
  191.  
  192.  
  193.             if (Jtag.activeConnection)
  194.             {
  195.                 textBox1.Text = ("Connected");
  196.  
  197.  
  198.             }
  199.             else
  200.             {
  201.                 textBox1.Text = ("Failed");
  202.             }
  203.         }
  204.  
  205.         uint elemshader = 0;
  206.         uint shader = 0;
  207.         uint elem = 0;
  208.         string elemtext = "";
  209.  
  210.         void Newsbar()
  211.         {
  212.             for (int j = 0; j <= 17; j++)
  213.             {
  214.                 elemshader = createElem(1);
  215.                 shader = getMaterialIndex("black");
  216.                 setIcon(1, elemshader, shader, 2000, 50, 320, 400, 1, 0, 2);
  217.                 spawnElem(1, elemshader);
  218.                 elem = createElem(j);
  219.                 SetText(j, elem, uintBytes(createText(elemtext)), 10, 10, 435, 0, 255);
  220.                 spawnElem(j, elem);
  221.             }
  222.         }
  223.  
  224.         private void button3_Click(object sender, EventArgs e)
  225.         {
  226.             Thread n = new Thread(Newsbar);
  227.             elemtext = HUD_0.Text;
  228.             n.Start();
  229.         }
  230.     }
  231. }
Advertisement
Add Comment
Please, Sign In to add comment