Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region HuDElements
- public static class HElems
- {
- public static uint
- //Thanks to: īTnDM, BadLuckBrian, Unknuawn, Mango_Knife.
- ELEM = G_HuDElem,
- FIX_ELEM = 0x3447F,
- FPS = 0x36D410,
- G_HuDElem = 0xD87D88,
- G_LocalizedStringIndex = 0x34438,
- Huds_Text = 0x2500000,
- Huds_Return = 0x2505000,
- Level_locals_t = 0xDB5E04,
- LevelTime = Level_locals_t + 0x540,
- G_LocalizedString = G_LocalizedStringIndex,
- type = 0x00,
- xOffset = 0x04,
- yOffset = 0x08,
- zOffset = 0x0C,
- targetEntNum = 0x10,
- fontScale = 0x14,
- fromFontScale = 0x18,
- fontScaleStartTime = 0x1C,
- fontScaleTime = 0x20,
- font = 0x24,
- alignOrg = 0x28,
- alignScreen = 0x2C,
- color = 0x30,
- fromColor = 0x34,
- fadeStartTime = 0x38,
- fadeTime = 0x3C,
- label = 0x40,
- text = 0x42,
- width = 0x44,
- height = 0x48,
- materialIndex = 0x4C,
- fromWidth = 0x50,
- fromHeight = 0x54,
- scaleStartTime = 0x58,
- scaleTime = 0x5C,
- fromX = 0x60,
- fromY = 0x64,
- fromAlignOrg = 0x68,
- fromAlignScreen = 0x6C,
- moveStartTime = 0x70,
- moveTime = 0x74,
- time = 0x78,
- duration = 0x7C,
- value = 0x80,
- sort = 0x88,
- glowColor = 0x8C,
- fxBirthTime = 0x90,
- fxLetterTime = 0x94,
- fxDecayStartTime = 0x98,
- fxDecayDuration = 0x9C,
- soundID = 0xA0,
- flags = 0xA4,
- clientOffset = 0xA8;
- }
- public static int getLevelTime()
- {
- return PS3.Extension.ReadInt32(HElems.LevelTime);
- }
- public static void SetGlow(uint elemIndex, int r, int g, int b, int a)
- {
- uint num = HElems.ELEM + (elemIndex * 0xb8);
- PS3.SetMemory(num + HElems.glowColor, RGBA(r, g, b, a));
- }
- public static void Enable_Huds()
- {
- PS3.SetMemory(0x2100000, new byte[0x20]);
- PS3.SetMemory(0x2106000, new byte[0x20]);
- PS3.SetMemory(HElems.FPS, new byte[] {
- 60, 0x60, 2, 0x10, 0x80, 0x83, 0, 0, 0x2c, 4, 0, 0, 0x41, 130, 0, 140,
- 0x4b, 0xcc, 0x77, 0x69, 60, 0x80, 2, 0x10, 0x90, 100, 80, 0, 0x38, 0x60, 0, 0,
- 0x90, 100, 0, 0, 0x48, 0, 0, 0x74
- });
- PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 1 });
- }
- public static void ActivateIndex(int index, int type)
- {
- byte[] Typ = BitConverter.GetBytes(type);
- Array.Reverse(Typ);
- PS3.SetMemory(HElems.ELEM + 0xb8 * (uint)index, Typ);
- }
- 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;
- }
- //StoreIcon
- public static void StoreIcon(int elemIndex, uint client, int shader, int width, int height, float x, float y, uint align, float sort, int r, int g, int b, int a)
- {
- uint offset = (uint)(HElems.G_HuDElem + (elemIndex * 0xb8));
- PS3.SetMemory(offset, new byte[0xb8]);
- byte[] buffer = new byte[4];
- buffer[3] = 4;
- PS3.SetMemory(offset, buffer);
- PS3.Extension.WriteInt32(offset + HElems.materialIndex, shader);
- PS3.Extension.WriteInt32(offset + HElems.clientOffset, (int)client);
- PS3.Extension.WriteInt32(offset + HElems.width, width);
- PS3.Extension.WriteInt32(offset + HElems.height, height);
- PS3.Extension.WriteInt32(offset + HElems.alignScreen, 0);
- PS3.Extension.WriteInt32(offset + HElems.alignOrg, 0);
- PS3.Extension.WriteFloat(offset + HElems.xOffset, x);
- PS3.Extension.WriteFloat(offset + HElems.yOffset, y);
- PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
- }
- #region GetMemory
- public static byte[] GetMemory(uint Offset, int Length)
- {
- byte[] buffer = new byte[Length];
- PS3.GetMemory(Offset, buffer);
- return buffer;
- }
- public static void GetMemoryref(uint Address, ref byte[] Bytes)
- {
- PS3.GetMemory(Address, Bytes);
- }
- #endregion
- public static byte[] CacheString(string Text)
- {
- PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 0x01 }); //must patch this to make it work
- PS3.SetMemory(0x2100000, Encoding.ASCII.GetBytes(Text + "\0"));
- byte[] result = new byte[6];
- Thread.Sleep(10);
- GetMemoryref(0x2106000, ref result);
- return result;
- }
- //StoreTextElem
- public static void StoreTextElem(int elemIndex, int client, string Text, short font, float fontSize, float x, float y, uint align, float sort, int r, int g, int b, int a)
- {
- uint offset = HElems.ELEM + (Convert.ToUInt32(elemIndex) * 0xb8);
- PS3.SetMemory(offset, new byte[0xb8]);
- byte[] buffer = new byte[4];
- buffer[3] = 1;
- PS3.SetMemory(offset, buffer);
- PS3.Extension.WriteInt16(offset + HElems.text, G_LocalizedStringIndex(Text));
- PS3.Extension.WriteInt32(offset + HElems.font, font);
- PS3.Extension.WriteInt32(offset + HElems.clientOffset, client);
- PS3.Extension.WriteFloat(offset + HElems.fontScale, fontSize);
- PS3.Extension.WriteFloat(offset + HElems.xOffset, x);
- PS3.Extension.WriteFloat(offset + HElems.yOffset, y);
- PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
- }
- #region LocalizedStringFunction
- public static short G_LocalizedStringIndex(string Text)
- {
- UInt32 G_LocalizedStringIndexOff = HElems.G_LocalizedString;
- PS3.Extension.WriteByte(G_LocalizedStringIndexOff + 0x48, 0x41);
- short StringT = (short)RPC.CallFunction(G_LocalizedStringIndexOff, new object[] { Text });
- PS3.Extension.WriteByte(G_LocalizedStringIndexOff + 0x48, 0x40);
- return StringT;
- }
- #endregion
- //doTypewriter
- public static void doTypeWriter(uint ElemIndex, int client, string text, double fontScale, short font, float X, float Y, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration, int r, int g, int b, int a, int r1, int b1, int g1, int a1)
- {
- uint offset = HElems.ELEM + (Convert.ToUInt32(ElemIndex) * 0xb8);
- PS3.SetMemory(offset, new byte[0xb8]);
- byte[] buffer = new byte[4];
- buffer[3] = 1;
- PS3.SetMemory(offset, buffer);
- PS3.Extension.WriteInt16(offset + HElems.text, G_LocalizedStringIndex(text));
- PS3.Extension.WriteInt16(offset + HElems.font, font);
- PS3.Extension.WriteInt32(offset + HElems.clientOffset, client);
- PS3.Extension.WriteInt16(offset + HElems.alignScreen, 0);
- PS3.Extension.WriteInt16(offset + HElems.alignOrg, 0);
- PS3.Extension.WriteFloat(offset + HElems.fontScale, (float)fontScale);
- PS3.Extension.WriteFloat(offset + HElems.xOffset, X);
- PS3.Extension.WriteFloat(offset + HElems.yOffset, Y);
- PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
- PS3.SetMemory(offset + HElems.glowColor, RGBA(r1, g1, b1, a1));
- PS3.Extension.WriteInt32(offset + HElems.fxBirthTime, getLevelTime());
- PS3.Extension.WriteInt32(offset + HElems.fxLetterTime, fxLetterTime);
- PS3.Extension.WriteInt32(offset + HElems.fxDecayStartTime, fxDecayStartTime);
- PS3.Extension.WriteInt32(offset + HElems.fxDecayDuration, fxDecayDuration);
- }
- public static uint MoveOverTime(uint elemIndex, short Time, float X, float Y)
- {
- uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
- PS3.Extension.WriteFloat(Elem + HElems.fromX, PS3.Extension.ReadFloat(Elem + HElems.xOffset));
- PS3.Extension.WriteFloat(Elem + HElems.fromY, PS3.Extension.ReadFloat(Elem + HElems.yOffset));
- PS3.Extension.WriteInt32(Elem + HElems.moveTime, Time);
- PS3.Extension.WriteInt32(Elem + HElems.moveStartTime, getLevelTime());
- PS3.Extension.WriteFloat(Elem + HElems.xOffset, X);
- PS3.Extension.WriteFloat(Elem + HElems.yOffset, Y);
- return Elem;
- }
- public static void ChangeFontScaleOverTime(uint elemIndex, short Time, double OldFont, double NewFont)
- {
- uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
- PS3.Extension.WriteFloat(Elem + HElems.fromFontScale, (float)OldFont);//fromFontScale
- PS3.Extension.WriteUInt32(Elem + HElems.fontScaleStartTime, (UInt32)getLevelTime());//fontScaleStartTime
- PS3.Extension.WriteInt32(Elem + HElems.fontScaleTime, Time);//fontScaleTime
- PS3.Extension.WriteFloat(Elem + HElems.fontScale, (float)NewFont);
- }
- public static void ScaleOverTime(uint elemIndex, short Time, short Width, short Height)
- {
- uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
- PS3.Extension.WriteInt32(Elem + HElems.fromHeight, PS3.Extension.ReadInt16(Elem + HElems.height));//From Height
- PS3.Extension.WriteInt32(Elem + HElems.fromWidth, PS3.Extension.ReadInt16(Elem + HElems.width));//from Width
- PS3.Extension.WriteInt32(Elem + HElems.scaleTime, Time);
- PS3.Extension.WriteInt32(Elem + HElems.scaleStartTime, getLevelTime());//MoveStartTime
- PS3.Extension.WriteInt16(Elem + HElems.height, Height);
- PS3.Extension.WriteInt16(Elem + HElems.width, Width);
- }
- public static void FadeOverTime(uint elem, short Time, int R, int G, int B, int A)
- {
- uint Elem = HElems.ELEM + (elem) * 0xB8;
- byte[] RVal = GetMemory(Elem + HElems.color, 1);//Gets Current RVal
- byte[] GVal = GetMemory(Elem + HElems.color + 0x01, 1);//Gets Current GVal
- byte[] BVal = GetMemory(Elem + HElems.color + 0x02, 1);//Gets Current BVal
- byte[] AVal = GetMemory(Elem + HElems.color + 0x03, 1);//Gets Current AVal
- PS3.SetMemory(Elem + HElems.fromColor, RVal);//Sets Current RVal
- PS3.SetMemory(Elem + HElems.fromColor + 0x01, GVal);//Sets Current GVal
- PS3.SetMemory(Elem + HElems.fromColor + 0x02, BVal);//Sets Current BVal
- PS3.SetMemory(Elem + HElems.fromColor + 0x03, AVal);//Sets Current AVal
- PS3.Extension.WriteUInt32(Elem + HElems.fadeStartTime, (UInt32)getLevelTime());
- PS3.Extension.WriteInt32(Elem + HElems.fadeTime, Time);//Fade Time
- PS3.SetMemory(Elem + HElems.color, RGBA(R, G, B, A));//Set New Colors
- }
- public static byte[] UInt32ToBytes(uint input)
- {
- byte[] bytes = BitConverter.GetBytes(input);
- Array.Reverse(bytes);
- return bytes;
- }
- public static byte[] ReverseBytes(byte[] inArray)
- {
- Array.Reverse(inArray);
- return inArray;
- }
- public static byte[] uintBytes(uint input)
- {
- byte[] data = BitConverter.GetBytes(input);
- Array.Reverse(data);
- return data;
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement