public static class HElems
{
//Udpated to 1.14 - by iTnDM
public static uint ELEM = 0xD87D88;
public static uint FPS = 0x36D410;
public static uint FIX_ELEM = 0x3447F;
public static uint G_LocalizedStringIndex = 0x34438;
public static uint
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 void ActivateIndex(int index, int type)
{
byte[] bytes = BitConverter.GetBytes(type);
Array.Reverse(bytes);
PS3.SetMemory(HElems.ELEM + ((uint)(0xb8 * index)), bytes);
}
private byte[] CacheString(string Text)
{
PS3.SetMemory(0x2100000, Encoding.ASCII.GetBytes(Text + "\0"));
byte[] result = new byte[4];
Thread.Sleep(50);
PS3.GetMemory(0x2105000, result);
return result;
}
//StoreTextElem
public static void ChangeAlpha(int index, int r, int g, int b, int alpha)
{
uint num = HElems.ELEM + (Convert.ToUInt32(index) * 0xb;
PS3.SetMemory(num + HElems.color, RGBA(r, g, b, alpha));
}
public static void ChangeText(int index, string text, float X)
{
uint num = HElems.ELEM + (Convert.ToUInt32(index) * 0xb;
PS3.Extension.WriteFloat(num + HElems.xOffset, X);
PS3.Extension.WriteInt16(num + HElems.text, G_LocalizedStringIndex(text));
}
public static void ChangeTextSub(int index, string text)
{
uint num = HElems.ELEM + (Convert.ToUInt32(index) * 0xb;
PS3.Extension.WriteInt16(num + HElems.text, G_LocalizedStringIndex(text));
}
public static void DestroyAll()
{
PS3.SetMemory(HElems.ELEM, new byte[0x2d000]);
}
public static void DestroyElem(int index)
{
uint offset = (uint)(HElems.ELEM + (index * 0xb);
PS3.SetMemory(offset, new byte[0xb8]);
}
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) * 0xb;
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 void doTypeWriterCustom(uint Index, ushort fxLetterTime, ushort fxDecayStartTime, ushort fxDecayDuration)
{
uint num = HElems.ELEM + (Index * 0xb;
PS3.Extension.WriteInt32(num + HElems.fxBirthTime, getLevelTime());
PS3.Extension.WriteInt32(num + HElems.fxLetterTime, fxLetterTime);
PS3.Extension.WriteInt32(num + HElems.fxDecayStartTime, fxDecayStartTime);
PS3.Extension.WriteInt32(num + HElems.fxDecayDuration, fxDecayDuration);
}
public static short G_LocalizedStringIndex(String Text)
{
return (short)RPC.CallFunction(HElems.G_LocalizedStringIndex, new object[] { Text });
}
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 int getLevelTime()
{
return PS3.Extension.ReadInt32(0xDB6344);
}
public static byte[] GetMemory(uint offset, int length)
{
byte[] buffer = new byte[length];
PS3.GetMemory(offset, buffer);
return buffer;
}
private static uint HudElem_Alloc()
{
for (int i = 0; i < 0x400; i++)
{
uint offset = (uint)(HElems.ELEM + (i * 0xb);
if (GetMemory(offset, 4)[3] == 0)
{
PS3.SetMemory(offset + HElems.type, new byte[0xb8]);
return offset;
}
}
return 0;
}
public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
{
byte[] buffer = new byte[4];
byte[] bytes = BitConverter.GetBytes(Convert.ToInt32(R));
byte[] buffer3 = BitConverter.GetBytes(Convert.ToInt32(G));
byte[] buffer4 = BitConverter.GetBytes(Convert.ToInt32(B));
byte[] buffer5 = BitConverter.GetBytes(Convert.ToInt32(A));
buffer[0] = bytes[0];
buffer[1] = buffer3[0];
buffer[2] = buffer4[0];
buffer[3] = buffer5[0];
return buffer;
}
public static void SetGlow(uint elemIndex, int r, int g, int b, int a)
{
uint num = HElems.ELEM + (elemIndex * 0xb;
PS3.SetMemory(num + HElems.glowColor, RGBA(r, g, b, a));
}
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.ELEM + (elemIndex * 0xb);
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));
}
public static void StoreTextElem(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint elem = Hud.HElems.ELEM + ((Convert.ToUInt32(elemIndex)) * 0xB;
PS3.SetMemory(elem, new byte[0xB8]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });
PS3.Extension.WriteInt16(elem + HElems.text, G_LocalizedStringIndex(Text));
PS3.Extension.WriteInt32(elem + HElems.font, font);
PS3.Extension.WriteInt32(elem + HElems.clientOffset, client);
PS3.Extension.WriteFloat(elem + HElems.fontScale, (float)fontScale);
PS3.Extension.WriteFloat(elem + HElems.xOffset, x);
PS3.Extension.WriteFloat(elem + HElems.yOffset, y);
PS3.SetMemory(elem + HElems.color, RGBA(r, g, b, a));
}
}
internal class RPC
{
//Choco's RPC CEX/DEX - 1.14 [Using PS3Lib]
//Choco's RPC CEX/DEX - 1.14 [Using PS3Lib]
#region RPC
private static uint function_address = 0x4A0300;
public static PS3API PS3 = new PS3API(SelectAPI.TargetManager);
public static int CallFunction(uint func_address, params object[] parameters)
{
int length = parameters.Length;
uint num2 = 0;
for (uint i = 0; i < length; i++)
{
if (parameters[i] is int)
{
byte[] array = BitConverter.GetBytes((int)parameters[i]);
Array.Reverse(array);
PS3.SetMemory(0x10050000 + ((i + num2) * 4), array);
}
else if (parameters[i] is uint)
{
byte[] buffer2 = BitConverter.GetBytes((uint)parameters[i]);
Array.Reverse(buffer2);
PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer2);
}
else if (parameters[i] is string)
{
byte[] buffer3 = Encoding.UTF8.GetBytes(Convert.ToString(parameters[i]) + "\0");
PS3.SetMemory(0x10050054 + (i * 0x400), buffer3);
uint num4 = 0x10050054 + (i * 0x400);
byte[] buffer4 = BitConverter.GetBytes(num4);
Array.Reverse(buffer4);
PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer4);
}
else if (parameters[i] is float)
{
num2++;
byte[] buffer5 = BitConverter.GetBytes((float)parameters[i]);
Array.Reverse(buffer5);
PS3.SetMemory(0x10050024 + ((num2 - 1) * 4), buffer5);
}
}
byte[] bytes = BitConverter.GetBytes(func_address);
Array.Reverse(bytes);
PS3.SetMemory(0x1005004c, bytes);
System.Threading.Thread.Sleep(20);
byte[] memory = new byte[4];
PS3.GetMemory(0x10050050, memory);
Array.Reverse(memory);
return BitConverter.ToInt32(memory, 0);
}
public static void WritePPC()
{
PS3.SetMemory(function_address, new byte[] { 0x4e, 0x80, 0, 0x20 });
System.Threading.Thread.Sleep(20);
byte[] memory = new byte[] {
0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x80, 60, 0x60, 0x10, 5, 0x81, 0x83, 0, 0x4c,
0x2c, 12, 0, 0, 0x41, 130, 0, 100, 0x80, 0x83, 0, 4, 0x80, 0xa3, 0, 8,
0x80, 0xc3, 0, 12, 0x80, 0xe3, 0, 0x10, 0x81, 3, 0, 20, 0x81, 0x23, 0, 0x18,
0x81, 0x43, 0, 0x1c, 0x81, 0x63, 0, 0x20, 0xc0, 0x23, 0, 0x24, 0xc0, 0x43, 0, 40,
0xc0, 0x63, 0, 0x2c, 0xc0, 0x83, 0, 0x30, 0xc0, 0xa3, 0, 0x34, 0xc0, 0xc3, 0, 0x38,
0xc0, 0xe3, 0, 60, 0xc1, 3, 0, 0x40, 0xc1, 0x23, 0, 0x48, 0x80, 0x63, 0, 0,
0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 60, 0x80, 0x10, 5, 0x38, 160, 0, 0,
0x90, 0xa4, 0, 0x4c, 0x90, 100, 0, 80, 0xe8, 1, 0, 0x80, 0x7c, 8, 3, 0xa6,
0x38, 0x21, 0, 0x70, 0x4e, 0x80, 0, 0x20
};
PS3.SetMemory(function_address + 4, memory);
PS3.SetMemory(0x10050000, new byte[0x2854]);
PS3.SetMemory(function_address, new byte[] { 0xf8, 0x21, 0xff, 0x91 });
}
}
}
#endregion
Enable_Hud();
WritePPC();
Copyright © 2024, NextGenUpdate.
All Rights Reserved.