Post: [Release] HUD elements + Remote Procedure Calls
05-21-2013, 12:55 AM #1
Choco
Respect my authoritah!!
(adsbygoogle = window.adsbygoogle || []).push({}); You must login or register to view this content.


Hey guys,

Since everyone is starting to figure this out now, it's time to release. I've had it for quite awhile, but wouldn't have found it without aerosoul94, so big thanks to him. Also, a lot of my HUD functions have been adapted from Hacksorce's Xbox functions, so thanks to him. Also thanks to Carter and Godly for their research.



Ok, so I'm going to be giving you all several things in this thread. Firstly, I am going to give you the functions needed to make your own HUD element menu in C#. Secondly, I am going to show you all how to call any MW3 function you want remotely (Remote Procedure Call).


HUD Elements

Ok, so first, you need to have your program set up to connect to your PS3. If you haven't done this, check out You must login or register to view this content..

Now, you are going to add this code to your program (you can also get it You must login or register to view this content. on pastebin):

            public static class HElems
{
public static uint
xOffset = 0x04,
yOffset = 0x08,
textOffset = 0x84,
fontOffset = 0x24,
fontSizeOffset = 0x14,
colorOffset = 0x30,
relativeOffset = 0x2c,
widthOffset = 0x44,
heightOffset = 0x48,
shaderOffset = 0x4c,
GlowColor = 0x8C,
alignOffset = 0x2C;
}

public void setIcon(uint elem, uint shader, int width, int height, float x, float y, uint align, float sort = 0, int r = 255, int g = 255, int b = 255, int a = 255)
{
SetMemory(elem, new byte[0xB4]);
SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });

SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
SetMemory(elem + HElems.shaderOffset, uintBytes(shader));
SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
SetMemory(elem + HElems.alignOffset, uintBytes(align));
SetMemory(elem + HElems.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
SetMemory(elem + HElems.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
}

public void setText(uint elem, byte[] text, uint font, float fontScale, float x, float y, uint align, int r = 255, int g = 255, int b = 255, int a = 255)
{
SetMemory(elem, new byte[0xB4]);
SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });

SetMemory(elem + HElems.textOffset, text);
SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
SetMemory(elem + HElems.fontOffset, uintBytes(font));
SetMemory(elem + HElems.alignOffset, uintBytes(align));
SetMemory(elem + HElems.textOffset + 4, new byte[] { 0x40, 0x00 });
SetMemory(elem + HElems.fontSizeOffset, ReverseBytes(BitConverter.GetBytes(fontScale)));
SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
SetMemory(elem + HElems.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
}


private void SetMemory(uint addr, byte[] val)
{
snresult = PS3TMAPI.ProcessSetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0xFFFFFFFF, addr, val);
}

private void RPC_Enable_124()
{
SetMemory(0x523B10, new byte[2175]);
SetMemory(0x18BE6C, new byte[] { 0x60, 0x00, 0x00, 0x00 });
SetMemory(0x3BC9CC, new byte[] { 0x60, 0x00, 0x00, 0x00 });
SetMemory(0x18BE74, new byte[] { 0x48, 0x00, 0x00, 0x68 });
SetMemory(0x1DB1244, new byte[4]);
SetMemory(0x114AE64, new byte[4]);
SetMemory(0x3BC9E4, new byte[] { 0x41, 0x82, 0x02, 0x20, 0x3D, 0x00, 0x00, 0x52, 0x80, 0x68, 0x3B, 0x10, 0x80, 0x88, 0x3B, 0x14, 0x80, 0xA8, 0x3B, 0x18, 0x80, 0xC8, 0x3B, 0x1C, 0x80, 0xE8, 0x3B, 0x20, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x1D, 0x3C, 0x80, 0x01, 0x15, 0x90, 0x64, 0xAE, 0x64, 0x38, 0x80, 0x00, 0x00, 0x3C, 0x60, 0x01, 0xDB, 0x90, 0x83, 0x12, 0x44, 0x48, 0x00, 0x01, 0xE8, 0x4E, 0x80, 0x00, 0x20, 0x60, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00 });
}

private uint str_pointer(string str)
{
uint addr = 0x523B30;
byte[] check = new byte[1];
uint i;
for (i = 0; i < 5; i++)
{
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0xFFFFFFFF, addr, ref check);
if (check[0] == 0x00) break;
if (i == 4)
{
i = 0;
break;
}
}
addr = (0x523B30 + (i * 0x6Cool Man (aka Tustin));
SetMemory(addr, new byte[0x68]);
SetMemory(addr, Encoding.UTF8.GetBytes(str));
return addr;
}

private void CallFunc(uint func_addr, uint param1 = 0, uint param2 = 0, uint param3 = 0, uint param4 = 0, uint param5 = 0)
{
byte[] par1 = BitConverter.GetBytes(param1);
byte[] par2 = BitConverter.GetBytes(param2);
byte[] par3 = BitConverter.GetBytes(param3);
byte[] par4 = BitConverter.GetBytes(param4);
byte[] par5 = BitConverter.GetBytes(param5);
Array.Reverse(par1);
Array.Reverse(par2);
Array.Reverse(par3);
Array.Reverse(par4);
Array.Reverse(par5);
SetMemory(0x523B10, par1);
SetMemory(0x523B14, par2);
SetMemory(0x523B18, par3);
SetMemory(0x523B1C, par4);
SetMemory(0x523B20, par5);
SetMemory(0x3BCA04, MakeBl(0x3BCA04, func_addr));
SetMemory(0x1DB1244, new byte[] { 0x00, 0x00, 0x00, 0x01 });
System.Threading.Thread.Sleep(10);
}

private uint GetFuncReturn()
{
byte[] ret = new byte[4];
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0xFFFFFFFF, 0x114AE64, ref ret);
Array.Reverse(ret);
return BitConverter.ToUInt32(ret, 0);
}

private byte[] MakeBl(uint callAddr, uint addrToBlTo)
{
byte[] instruction = new byte[4];
uint addr_t = (uint)(((int)addrToBlTo - (int)callAddr) + 1);
if ((int)addrToBlTo > (int)callAddr) instruction[3] = 0x48;
else
{
instruction[3] = 0x4B;
addr_t = (uint)(0x1000000 - ((int)callAddr - (int)addrToBlTo) + 1);
}
byte[] addr = BitConverter.GetBytes(addr_t);
for (int i = 0; i < 3; i++)
{
instruction[i] = addr[i];
}
Array.Reverse(instruction);
return instruction;
}

public void DestroyElem(uint elem)
{
SetMemory(elem, new byte[0xB4]);
}

public void spawnElem(int client, uint elemAddress)
{
SetMemory(elemAddress + 0xA8, ReverseBytes(BitConverter.GetBytes(client)));
}

public byte[] uintBytes(uint input)
{
byte[] data = BitConverter.GetBytes(input);
Array.Reverse(data);
return data;
}

public uint createText(string text)
{
CallFunc(0x1BE6CC, str_pointer(text));
System.Threading.Thread.Sleep(10);
return GetFuncReturn();
}

public byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}

private uint HudElem_Alloc()
{
byte[] elem = new byte[1];
uint add;
for (int i = 0; i < 1024; i++)
{
add = (uint)(0xF0E10C + (i * 0xB4));
PS3TMAPI.ProcessGetMemory(0, PS3TMAPI.UnitType.PPU, ProcessID, 0xFFFFFFFF, add, ref elem);
if ((int)elem[0] == 0)
{
SetMemory(add, new byte[0xB1]);
return add;
}
}
return 0;
}

private void HudElem_DestroyAll()
{
SetMemory(0xF0E10C, new byte[184320]);
}

private int GetMaterialIndex(string str)
{
CallFunc(0x1BE744, str_pointer(str));
return (int)GetFuncReturn();
}


That's all the functions you need for HUD elements and for RPC (remote procedure calls). Now, add this to the end of the function you use for attaching the process:

    RPC_Enable_124();


That code will add a custom function into MW3 that allows you to call functions remotely (I'll explain how to do so later).



Here's an example of spawning a Text HUD element:

    uint hud_example = HudElem_Alloc();
setText(hud_example, uintBytes(createText("Example Text")), 6, 20, 170, 45, 1, 255, 0, 0, 255);
spawnElem(0, hud_example);


Here's an example of spawning a Shader HUD element:

    uint hud_example2 = HudElem_Alloc();
setIcon(hud_example2, 1, 280, 100, 40, 30, 2, -10, 0, 0, 0, 150);
spawnElem(0, hud_example2);


Also, for anyone interested, here is the complete HUD elem structure thanks to aerosoul94: You must login or register to view this content.


Remote Procedure Call

Ok, all the code that you should have added to your program from above included all the funcs needed for RPC. Here's how to call a function remotely:

For this example, I will use G_GivePlayerWeapon.

First, you need the address of the function to call from within the elf. G_GivePlayerWeapon is located at 0x1C3034. Now you need the parameters for it. G_GivePlayerWeapon takes 3 parameters: g_client, weaponIndex, and altModelIndex.

So to call the function, I would do something like this:

    uint G_GivePlayerWeapon = 0x1C3034;
uint g_client = 0x110A280;
CallFunc(G_GivePlayerWeapon, g_client, 1, 0);


That code would give a Default Weapon to client number 0.

RPC is a bit more advanced, so if what I just said made no sense to you, don't worry about it. Here's some good functions for you to have:

    uint Add_Ammo = 0x18A29C; //Add_Ammo(uint *g_entity, uint weaponIndex, uint weaponModel, uint count, uint fillClip)
uint G_GivePlayerWeapon = 0x1C3034; //G_GivePlayerWeapon(uint *g_client, uint weaponIndex, uint altModelIndex)
uint G_SetModel = 0x1BEF5C; //G_SetModel(uint *g_entity, char *modelName)
uint Cmd_ExecuteSingleCommand = 0x1DB240; //Cmd_ExecuteSingleCommand(uint *localClientIndex, char *command)


Here's an example of a function that uses a string as a parameter:

    uint G_SetModel = 0x1BEF5C;
CallFunc(G_SetModel, 0xFCA280, str_pointer("com_plasticcase_beige_big"));


str_pointer is needed whenever passing a string to CallFunc.

And for those who are completely lost about RPC, here's a few little functions I wrote in C# to make some mods easier for you:

            private void SetModel(int client, string model)
{
CallFunc(0x1BEF5C, (uint)(0xFCA280 + (client * 0x280)), str_pointer(model));
}

private void SV_GameSendServerCommand(int client, string command)
{
CallFunc(0x228FA8, (uint)client, 0, str_pointer(command));
}

private void GiveWeapon(int client, int weaponIndex)
{
CallFunc(0x1C3034, (uint)(0x110A280 + (client * 0x3980)), (uint)weaponIndex, 0);
CallFunc(0x18A29C, (uint)(0xFCA280 + (client * 0x280)), (uint)weaponIndex, 0, 9999, 1);
}


Examples using the above functions:

    SetModel(0, "com_plasticcase_beige_big"); //sets client 0's model to a Care Package

SV_GameSendServerCommand(0, "c \"^2Hello there!\""); //prints "^2Hello there!" on client 0's screen

GiveWeapon(0, 1); //Gives a default weapon with full ammo to client 0





Well, that's it. All the secrets are out now. Hopefully some of you found this useful and will make some sick mods with it. Once again, all credit for HUD elems goes to aerosoul94.


Enjoy guys Winky Winky
Last edited by Choco ; 05-22-2013 at 08:43 PM.

The following 143 users say thank you to Choco for this useful post:

-JM-, -Numb, ResistTheMoon, {CE} EdiTz-, {H} | Exception, *xActionMods*, ℳaTiCz, ⓙω мσ∂z, Eddie Mac, Adamâ„¢, AlexNGU, Alexon, Gambler, Ansity., Baptiste-, BaSs_HaXoR, BaumHF1, Bucko, YouAppreciateMe, Capo837, CARDIFF MoDz, BLiNDzZ, deneo24, Chip ♞, Chxii, cod5cl, Devastation, dgui123451, Dhaax., DiiMoON_YouTube, ErasedDev, Diversify, DonGiuliiano, Doodle, DubstepHD, EG6, EliteHackzPS3, EnzoMezzomo, FAKA_ELITE, FallofReach, Father Luckeyy, Flamby, FM|T Enstone, FM|T ZoRo, FutureOps, gaming_nation, Gendjisan, Giantsfan15, Hacker41822, HackersForHire, Harry, HolyCreepsHacks, Sir Quack, i_iTop_i, Beats, ibombo, II Dave II, iLLy-i, imD, ImSooCool, InfinityISB4CK, InHell, Insult, ItsMagiicsz, JamesSwagger, ResistTheJamsha, Jannik007, Johnny_C, KCxFTW, KingcreekS, kiwi_modz, KrElZo, Loxy, lucasaf01, M6no5, ManderModz, Mango_Knife, matt0897, milky4444, Moment, MoTmrD, Mr Grumpy, MrKiller261, MrMemory, MrXXPSNGAMERXx, NGU-xNiicKzHD, John, NUKES-X-MODS-X, O-H, Obris, pla3rsl3g3nd, primetime43, Pseudo_Soldier, Pulsar877, RevSwaG, Rick, riggstq, Master Ro and 43 other users.
05-27-2013, 12:26 AM #38
xJuLo
Save Point
Delete snresult. It is useless

The following 2 users say thank you to xJuLo for this useful post:

milky4444, Pxchez
05-27-2013, 03:37 AM #39
Choco
Respect my authoritah!!
Originally posted by C123 View Post
You can call functions on ps3 now?


Yep. It's not supported by sony so I had to write up a code to do it. If you're interested, the function I inject into memory looks like this:

You must login or register to view this content.

Then the code I use in C# generates a bl instruction for the function you want to call and writes it over the original bl within that custom func, writes out the parameters for the function to the addresses they get loaded from, and sets 0x1DB1244 to 1 to cause my code in the ELF to be executed.

The following 3 users say thank you to Choco for this useful post:

BadChoicesZ, C123, SC58
05-27-2013, 07:29 PM #40
C123
Do a barrel roll!
Originally posted by Choco View Post
Yep. It's not supported by sony so I had to write up a code to do it. If you're interested, the function I inject into memory looks like this:

You must login or register to view this content.

Then the code I use in C# generates a bl instruction for the function you want to call and writes it over the original bl within that custom func, writes out the parameters for the function to the addresses they get loaded from, and sets 0x1DB1244 to 1 to cause my code in the ELF to be executed.


Great work! Smile
06-08-2013, 09:04 AM #41
BayAreaLobbies
Do a barrel roll!
Very Nice Release , May Give it A Try Good Work Choco :nerd: :y:
06-09-2013, 06:23 AM #42
TheMrGeekyMoDz
Bounty hunter
Nice This Is HelpFull :y:
06-13-2013, 07:51 PM #43
First Chocco really nice Smile)
but im getting an error when starting my application

German: Fehler 2 Eine implizite Konvertierung vom Typ 'PS3TMAPI.SNRESULT' in 'string' ist nicht möglich. C:\PS3\MW3 MODMENU\C# Source\MW3 - Base Menu 1.24 By ZeiiKeN\MW3 - Base Menu 1.24 By ZeiiKeN\Form1.cs 322 24 MW3 - Base Menu 1.24 By ZeiiKeN

Englisch (google): Error 2 An implicit conversion from type 'PS3TMAPI.SNRESULT' to 'string' is not possible. C: \ PS3 \ MW3 MODMENU \ C # Source \ MW3 - Base Menu By 1:24 ZeiiKeN \ MW3 - Base Menu By 1:24 ZeiiKeN \ Form1.cs 322 24 MW3 - Base Menu By 1:24 ZeiiKeN :confused: :(
06-16-2013, 06:27 AM #44
Kurt
Banned
finnaly figured out how to spawn multiple HudElems Happy
06-16-2013, 10:35 AM #45
how do you do it?
06-17-2013, 03:36 AM #46
Not sure if you guys know this, but you can spawn icons by doing GetMaterialIndex(""rank_prestige1") and so on and so forth.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo