Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Ps3Memory
- {
- public static byte[] BIND = new byte[4];
- public static uint ProcessID;
- public static uint[] processIDs;
- private static string usage;
- public static PS3TMAPI.ConnectStatus connectStatus;
- public static string Status;
- public static void SetMemory(uint Address, byte[] Bytes)
- {
- PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0, Address, Bytes);
- }
- }
- public class HElems
- {
- public static uint
- type = 0x6D,
- xOffset = 0x00,
- yOffset = 0x04,
- textOffset = 0x62,
- sort = 32,
- fontSizeOffset = 0x0C,
- clientOffset = 0x7C,
- colorOffset = 0x18,
- GlowColor = 0x1c,
- widthOffset = 0x58,
- heightOffset = 0x5A,
- shaderOffset = 0x74,
- Material = 0x71;
- }
- public class Hudelem //Hud Elements
- {
- public static uint
- type = 0x6D,
- xOffset = 0x00,
- yOffset = 0x04,
- textOffset = 0x62,
- sort = 32,
- fontSizeOffset = 0x0C,
- clientOffset = 0x7C,
- colorOffset = 0x18,
- GlowColor = 0x44,
- widthOffset = 0x58,
- heightOffset = 0x5A,
- shaderOffset = 0x74,
- Material = 0x71;
- public class HUD
- {
- public static byte[] SetText(string Text)
- {
- byte[] clean = new byte[250];
- SetMemory(0x2000000, clean);
- SetMemory(0x2000000, Encoding.ASCII.GetBytes(Text + "\0"));
- byte[] Patch = new byte[] { 0x48, 0x44, 0xB3, 0x1D, 0x3C, 0x60, 0x00, 0xD8,
- 0x80, 0x63, 0xBC, 0xD8, 0x2C, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x7C, 0x3C, 0x60, 0x02, 0x00,
- 0x30, 0x63, 0x00, 0x00, 0x4B, 0xED, 0xE4, 0xED, 0x3c, 0x80, 0x02, 0x00, 0x90, 0x64, 0x50, 0x00,
- 0x48, 0x00, 0x00, 0x68, 0x4B, 0xFD, 0x80, 0x61 };
- byte[] Unpatch = new byte[] { 0x48, 0x44, 0xB3, 0x1D, 0x3C, 0x60, 0x00,
- 0xD8, 0x80, 0x63, 0xBC, 0xD8, 0x2C, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x7C, 0x3C, 0x60, 0x00,
- 0x39, 0x38, 0x80, 0x00, 0x00, 0x3B, 0xE3, 0x70, 0xE4, 0x63, 0x43, 0x00, 0x00, 0xC3, 0xFF, 0x00,
- 0x08, 0xFC, 0x20, 0xF8, 0x90, 0x4B, 0xFD, 0x80, 0x61 };
- SetMemory(0X03976DC, Patch);
- Thread.Sleep(15);
- SetMemory(0X03976DC, Unpatch);
- byte[] GetX = new byte[4];
- GetMemoryHUD(0x2005000, ref GetX);
- return GetX;
- }
- public static byte[] uintBytes(uint input)
- {
- byte[] data = BitConverter.GetBytes(input);
- Array.Reverse(data);
- return data;
- }
- private class MenuItems
- {
- public static uint Shader = 0, ScrollBarBackGround = 1;
- }
- public static byte[] ReverseBytes(byte[] inArray)
- {
- Array.Reverse(inArray);
- return inArray;
- }
- public static byte[] ToHexFloat(float Axis)
- {
- byte[] bytes = BitConverter.GetBytes(Axis);
- Array.Reverse(bytes);
- return bytes;
- }
- public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
- {
- byte[] RGBA = new byte[4];
- byte[] RVal = BitConverter.GetBytes(Convert.ToInt32(R));
- byte[] GVal = BitConverter.GetBytes(Convert.ToInt32(G));
- byte[] BVal = BitConverter.GetBytes(Convert.ToInt32(B));
- byte[] AVal = BitConverter.GetBytes(Convert.ToInt32(A));
- RGBA[0] = RVal[0];
- RGBA[1] = GVal[0];
- RGBA[2] = BVal[0];
- RGBA[3] = AVal[0];
- return RGBA;
- }
- public static void StoreIcon1(int elemIndex, uint client, int shader, int width, int height, int x, int y, uint align, float sort, int r, int g, int b, int a)
- {
- byte[] Material_ = BitConverter.GetBytes(shader);
- Array.Reverse(Material_);
- byte[] Height_ = BitConverter.GetBytes(Convert.ToInt32(height));
- Array.Resize(ref Height_, 2);
- Array.Reverse(Height_);
- byte[] width_ = BitConverter.GetBytes(Convert.ToInt32(width));
- Array.Resize(ref width_, 2);
- Array.Reverse(width_);
- uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
- byte[] ClientID = ReverseBytes(BitConverter.GetBytes(client));
- SetMemory(elem, new byte[0x88]);
- SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(8)));
- SetMemory(elem + 0x79, new byte[] { 0xFF });
- SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
- SetMemory(elem + Hudelem.Material, Material_);
- SetMemory(elem + Hudelem.heightOffset, Height_);
- SetMemory(elem + Hudelem.widthOffset, width_);
- SetMemory(elem + Hudelem.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
- SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
- SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
- SetMemory(elem + Hudelem.colorOffset, RGBA(r, g, b, a));
- SetMemory(elem + Hudelem.clientOffset, ClientID);
- System.Threading.Thread.Sleep(20);
- }
- public static void StoreTextElem1(int elemIndex, int client, string text, int font, int fontScale, int x, int y, uint align, int sort, int R, int V, int B, int a)
- {
- string setText = text + "\0";
- byte[] TextIndex = SetText(setText);
- uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
- byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
- int typez = a;
- Ps3Memory.SetMemory(elem + HElems.type, ReverseBytes(BitConverter.GetBytes(typez)));
- SetMemory(elem, new byte[0x88]);
- SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
- SetMemory(elem + 0x79, new byte[] { 0xFF });
- SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
- SetMemory(elem + Hudelem.textOffset, TextIndex);
- SetMemory(elem + Hudelem.fontSizeOffset,
- ReverseBytes(BitConverter.GetBytes(Convert.ToSingle(font))));
- SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
- SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
- SetMemory(elem + Hudelem.colorOffset, RGBA(R, V, B, a));
- SetMemory(elem + Hudelem.clientOffset, ClientID);
- System.Threading.Thread.Sleep(20);
- }
- public static void SetGlow(int elemIndex, int client, string text, int font, int fontScale, int x, int y, uint align, int sort, int R, int V, int B, int a, int GlowR, int GlowG, int GlowB, int GlowA)
- {
- string setText = text + "\0";
- byte[] TextIndex = SetText(setText);
- uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
- byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
- SetMemory(elem, new byte[0x88]);
- SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
- SetMemory(elem + 0x79, new byte[] { 0xFF });
- SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
- SetMemory(elem + Hudelem.textOffset, TextIndex);
- SetMemory(elem + Hudelem.fontSizeOffset,
- ReverseBytes(BitConverter.GetBytes(Convert.ToSingle(font))));
- SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
- SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
- SetMemory(elem + Hudelem.colorOffset, RGBA(R, V, B, a));
- SetMemory(elem + Hudelem.GlowColor,
- new byte[]
- {
- BitConverter.GetBytes(GlowR)[0], BitConverter.GetBytes (GlowG)[0],
- BitConverter.GetBytes(GlowB)[0], BitConverter.GetBytes (GlowA)[0]
- });
- SetMemory(elem + Hudelem.clientOffset, ClientID);
- System.Threading.Thread.Sleep(20);
- }
- public static void MoveShader1(uint index, int X_, int Y_, float TextSize_)
- {
- byte[] X = new byte[4];
- byte[] Y = new byte[4];
- byte[] TextSize = new byte[4];
- X = BitConverter.GetBytes(Convert.ToSingle(X_));
- Y = BitConverter.GetBytes(Convert.ToSingle(Y_));
- TextSize = BitConverter.GetBytes(Convert.ToSingle(TextSize_));
- byte[] Width = new byte[4];
- byte[] Height = new byte[4];
- Array.Reverse(X);
- Array.Reverse(Y);
- Array.Reverse(TextSize);
- SetMemory(0x15D8400 + (index * 0x88) + 0, X);
- SetMemory(0x15D8400 + (index * 0x88) + 4, Y);
- SetMemory(0x15D8400 + (index * 0x88) + 12, TextSize);
- }
- public static void MoveShader2(uint index, int X_, int Y_, int Width_, int Height_)
- {
- byte[] X = new byte[4];
- byte[] Y = new byte[4];
- X = BitConverter.GetBytes(Convert.ToSingle(X_));
- Y = BitConverter.GetBytes(Convert.ToSingle(Y_));
- byte[] Width = new byte[4];
- byte[] Height = new byte[4];
- Width = BitConverter.GetBytes(Width_);
- Height = BitConverter.GetBytes(Height_);
- Array.Reverse(X);
- Array.Reverse(Y);
- Array.Reverse(Width);
- Array.Reverse(Height);
- SetMemory(0x15D8400 + (index * 0x88) + 0, X);
- SetMemory(0x15D8400 + (index * 0x88) + 4, Y);
- SetMemory(0x15D8400 + (index * 0x88) + 68, Width);
- SetMemory(0x15D8400 + (index * 0x88) + 72, Height);
- }
- public static void DestroyElem(int index)
- {
- uint elem = 0x15D8400 + ((Convert.ToUInt32(index)) * 0x88);
- SetMemory(elem, new byte[0x88]);
- }
- }
- }
- //Functions
- public byte[] GetMemory2(uint address, int length)
- {
- byte[] buffer = new byte[length];
- PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, Ps3Memory.ProcessID, 0L, (ulong)address, ref buffer);
- return buffer;
- }
- public static void SetMemory(uint Address, byte[] Bytes)
- {
- PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, Ps3Memory.ProcessID, 0L, (ulong)Address, Bytes);
- }
- public static void GetMemoryHUD(uint Address, ref byte[] Bytes)
- {
- PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, Ps3Memory.ProcessID, 0, Address, ref Bytes);
- }
- private class MenuItems
- {
- public static uint Shader = 0, ScrollBarBackGround = 1;
- }
- public void NewsBar(uint client, bool state, string Text)
- {
- PS3TMAPI.InitTargetComms();
- PS3TMAPI.Connect(0, null);
- PS3TMAPI.GetProcessList(0, out Ps3Memory.processIDs);
- ulong uProcess = Ps3Memory.processIDs[0];
- Ps3Memory.ProcessID = Convert.ToUInt32(uProcess);
- PS3TMAPI.ProcessAttach(0, PS3TMAPI.UnitType.PPU, Ps3Memory.ProcessID);
- PS3TMAPI.ProcessContinue(0, Ps3Memory.ProcessID);
- if (state == false)
- {
- Hudelem.HUD.DestroyElem(600);
- Hudelem.HUD.DestroyElem(601);
- Hudelem.HUD.DestroyElem(602);
- Hudelem.HUD.DestroyElem(603);
- }
- else
- {
- //Red, Green, Blue, Alpha (transparency)
- var scrollspeed = 1; //Scrolling Speed
- Hudelem.HUD.StoreIcon1(600, client, 4, 2000, 30, -120, 403, 0, MenuItems.ScrollBarBackGround, 255, 255, 255, 240); //Background
- Hudelem.HUD.StoreIcon1(601, client, 3, 2000, 3, -120, 402, 0, MenuItems.ScrollBarBackGround, 255, 20, 0, 150); //Background
- Hudelem.HUD.StoreIcon1(602, client, 3, 2000, 3, -120, 432, 0, MenuItems.ScrollBarBackGround, 255, 20, 0, 150); //Background
- Hudelem.HUD.StoreTextElem1(603, (int)client, Text, 3, 1, 300, 453, MenuItems.Shader, 0, 255, 255, 255, 255); //Text
- for (int i = 800; i > -400; )
- {
- i = i - scrollspeed; //Speed
- Hudelem.HUD.MoveShader2(603, i, 400, 0, 0);
- if (i == -300)
- {
- i = 800;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment