Post: [Updated/1.10] Hud Elements
03-05-2014, 03:55 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I updated hud elements today aswell. It's everything you need for a mod menu now. Goodluck!

These scripts were originally Bad Luck Brians for 1.05, I don't use my hud elements like this so yeah... here you go.

Thanks to Shark the ppc is fixed :p


Hud Elements 1.10

    
public static class Hud
{
public static class HElems
{
public static uint //0xb8 4 = icon, 1 = text

ELEM = 0xD87888, //patched
FIX_ELEM = 0x335c7,
FPS = 0x36B260,

xOffset = 0x04,
yOffset = 0x08,
textOffset = 0x40,
fontOffset = 0x24,
fontSizeOffset = 0x14, //43 30 ..
colorOffset = 0x30,
relativeOffset = 0x28, //no idea idc.. set it to 0
widthOffset = 0x44,
heightOffset = 0x48,
shaderOffset = 0x4C,
GlowColor = 0x8C,
clientOffset = 0x10,
alignOffset = 0x2C; //set it to 0 also..


}


public static void Enable_Cacher()
{
PS3.SetMemory(0x2100000, new byte[32]);
PS3.SetMemory(0x2106000, new byte[32]);
PS3.SetMemory(0x36B260, new byte[] { 0x3C, 0x60, 0x02, 0x10, 0x80, 0x83, 0x00, 0x00, 0x2C, 0x04, 0x00, 0x00, 0x41, 0x82, 0x00, 0x8C, 0x4B, 0xCC, 0x83, 0x11, 0x3C, 0x80, 0x02, 0x10, 0x90, 0x64, 0x60, 0x00, 0x38, 0x60, 0x00, 0x00, 0x90, 0x64, 0x00, 0x00, 0x48, 0x00, 0x00, 0x74 });
PS3.SetMemory(0x335C7, new byte[] { 0x01 });
}


public static void ActivateIndex(int index, int type)
{

byte[] Typ = BitConverter.GetBytes(type);
Array.Reverse(Typ);
PS3.SetMemory(Hud.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;
}


public static void StoreIcon(uint elemIndex, decimal client, int shader, int width, int height, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xbCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
PS3.SetMemory(elem, new byte[0xB8]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });
PS3.SetMemory(elem + HElems.shaderOffset, ReverseBytes(BitConverter.GetBytes(shader)));
PS3.SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
PS3.SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);


}

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);
PS3.GetMemory(0x2106000, ref result);
return result;
}



public static void StoreTextElem(uint elemIndex, int client, string Text, int font, float fontScale, int x, int y, uint align, float sort, int r, int g, int b, int a, int r1, int g1, int b1, int a1)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xBCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(client));
PS3.SetMemory(elem, new byte[0xB4]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });
PS3.SetMemory(elem + HElems.textOffset, CacheString(Text));
PS3.SetMemory(elem + HElems.fontOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(font))));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(0))));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.fontSizeOffset, ToHexFloat(fontScale));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.GlowColor, RGBA(r1, g1, b1, a1));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);


}

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;
}

}


And before you people flame and say I got this from someone else, I didn't, Bad Luck Brian Taught me how to update them from 1.06. I did this on my own, except the offsets for the hud struct :p

Credits:
    
Bad Luck Brian - Teaching PPC, and how to cache strings
Shark - Fixing PPC Bug :p
SC58
Me - Updating from 1.07 to 1.10


Here is everything for you to make a mod menu

You must login or register to view this content.
You must login or register to view this content.
Last edited by Black Panther ; 04-04-2014 at 11:27 AM. Reason: Updated to 1.10

The following 12 users say thank you to Black Panther for this useful post:

Dannie Fresh, ResistTheJamsha, M-alShammary, Mango_Knife, Notorious, xProvXKiller, RatchetBooty, SnaY, Taylors Bish, Winter, x_action_x, xHostModer
03-05-2014, 09:41 PM #11
Originally posted by Prime
hey how do i fix this? You must login or register to view this content.


If you're using PS3Lib change it from
    ref result
to just
    result
03-06-2014, 04:03 AM #12
RatchetBooty
Former Staff
Wow thanks for releasing so much for the community :wub:

The following user thanked RatchetBooty for this useful post:

03-06-2014, 11:33 AM #13
iNDMx
Do a barrel roll!
thanks... but what is code
i know Client, 3, x, Y, .......
but i want source from This

HUDS.ELEMS(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

like that
03-06-2014, 04:00 PM #14
Originally posted by iNDMx View Post
thanks... but what is code
i know Client, 3, x, Y, .......
but i want source from This

HUDS.ELEMS(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

like that


What....
03-06-2014, 11:24 PM #15
Notorious
Caprisuns Is Back
Originally posted by AlmightySo View Post
I updated hud elements today aswell. It's everything you need for a mod menu now. Goodluck!

These scripts were originally Bad Luck Brians for 1.05, I don't use my hud elements like this so yeah... here you go.

Hud Elements 1.09

    
public static class Hud
{
public static class HElems
{
public static uint

ELEM = 0xD86E08,
FIX_ELEM = 0x00033227,
FPS = 0x369070,
G_LocalizedStringIndex = 0x331E0,
xOffset = 0x04,
yOffset = 0x08,
textOffset = 0x40,
fontOffset = 0x24,
fontSizeOffset = 0x14,
colorOffset = 0x30,
relativeOffset = 0x28,
widthOffset = 0x44,
heightOffset = 0x48,
shaderOffset = 0x4C,
GlowColor = 0x8C,
clientOffset = 0x10,
alignOffset = 0x2C;
}
public static void Enable_Cacher()
{
PS3.SetMemory(0x2100000, new byte[32]);
PS3.SetMemory(0x2105000, new byte[32]);
PS3.SetMemory(Hud.HElems.FPS, new byte[] { 0x3C, 0x60, 0x02, 0x10, 0x80, 0x83, 0x00, 0x00, 0x2C, 0x04, 0x00, 0x00, 0x41, 0x82, 0x00, 0x8C, 0x4B, 0xCC, 0xA1, 0x61, 0x3C, 0x80, 0x02, 0x10, 0x90, 0x64, 0x50, 0x00, 0x38, 0x60, 0x00, 0x00, 0x90, 0x64, 0x00, 0x00, 0x48, 0x00, 0x00, 0x74, 0x3B, 0xE4, 0x8F, 0xD4, 0x38, 0x80, 0x00, 0x00 });
PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 0x01 }); //1.09
}
public static void ActivateIndex(int index, int type)
{
byte[] Typ = BitConverter.GetBytes(type);
Array.Reverse(Typ);
PS3.SetMemory(Hud.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;
}
public static void StoreIcon(uint elemIndex, decimal client, int shader, int width, int height, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xbCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
PS3.SetMemory(elem, new byte[0xB8]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });
PS3.SetMemory(elem + HElems.shaderOffset, ReverseBytes(BitConverter.GetBytes(shader)));
PS3.SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
PS3.SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);
}
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[4];
Thread.Sleep(10);
PS3.GetMemory(0x2105000, ref result);
return result;
}
public static void StoreTextElem(uint elemIndex, int client, string Text, int font, float fontScale, int x, int y, uint align, float sort, int r, int g, int b, int a, int r1, int g1, int b1, int a1)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xBCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(client));
PS3.SetMemory(elem, new byte[0xB4]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });
PS3.SetMemory(elem + HElems.textOffset, CacheString(Text));
PS3.SetMemory(elem + HElems.fontOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(font))));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(0))));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.fontSizeOffset, ToHexFloat(fontScale));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.GlowColor, RGBA(r1, g1, b1, a1));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);


}
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;
}
}


And before you people flame and say I got this from someone else, I didn't, Bad Luck Brian Taught me how to update them from 1.06. I did this on my own, except the offsets for the hud struct :p

Credits:
    
Bad Luck Brian - Teaching PPC, and how to cache strings
SC58
Me - Updating from 1.07 to 1.09


Here is everything for you to make a mod menu

You must login or register to view this content.
You must login or register to view this content.
You must login or register to view this content.
You must login or register to view this content.

store text elem does not seem to be working
03-07-2014, 12:03 AM #16
Originally posted by Prime
store text elem does not seem to be working


Did you Enable String Caching?
03-07-2014, 12:05 AM #17
Notorious
Caprisuns Is Back
Originally posted by AlmightySo View Post
Did you Enable String Caching?


probaly not lmao
03-07-2014, 12:08 AM #18
Notorious
Caprisuns Is Back
Originally posted by AlmightySo View Post
Did you Enable String Caching?


well how because the arguments for cachestring is (string Text) there is no Boolean State or no definition to enable it.
03-07-2014, 01:17 AM #19
Originally posted by Prime
well how because the arguments for cachestring is (string Text) there is no Boolean State or no definition to enable it.


Okay this is how your form should be.

Add this after your attaching/rpc enable:
    
Hud.Enable_Cacher();


Then when you're gonna spawn a text element call it like this.

    
public static void TestSpawn()
{
Hud.StoreTextElem(120, 0, "This is a text elem", 4, 2.2f, 200, 60, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0);
}

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo