You are viewing our Forum Archives. To view or take place in current topics click here.
How to make an XRPC program
Posted:

How to make an XRPC programPosted:

OriginallyMark
  • TTG Senior
Status: Offline
Joined: May 07, 201113Year Member
Posts: 1,501
Reputation Power: 81
Status: Offline
Joined: May 07, 201113Year Member
Posts: 1,501
Reputation Power: 81
I have recently seen an up rise in requests for how to do certain things related to XRPC and how to actually make an XRPC program, so i am going to try and tackle both these requests, I am going to put down as many C# scripts as i have for the game "mordern warfare 2" and i invite you to do the same in the comments section, and i am also going to try and give the best description i can as to how the programs are made!

Making an XRPC program:

1) You are going to need the xrpc.dll, this can be found using google, or you can download it here: [ Register or Signin to view external links. ]

2) make a visual project file, it needs to be a c# template, and add a form, you are going to need the dll as a reference

[ Register or Signin to view external links. ]

3)Now we are going to add a connect button, just click on the toolbox and drag and drop a button, we are also going to need a textbox, leave the button as it is but rename the textbox, "Log", The button is going to connect to the jtag and the textbox is going to log the connection status, line them up how you like, it should like something like this:

[ Register or Signin to view external links. ]

4) now we are going to add some coding to our project, but to do this we need to make sure our program know's to use are XRPC.dll, To do this double click the form to get to the coding part of the project and know we are going to add to the top a piece of code that tells it to use the dll and also another which will come in handy later

using XRPCLib;
using System.Threading;


it should look like this: [ Register or Signin to view external links. ]

5) we are now going to define our jtag as a "Jtag" to do this we are going to add this:

XRPC Jtag = new XRPC();


not just anywhere though, we are going to add it just under this part of our code:
public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm
    {


Although unless you are using a Krypton extension to change the appearence of your form it will be slightly different, but still should look like this:

[ Register or Signin to view external links. ]

6) Now we can finally add our connect code! Go back to the design page and double click our button, we can add our code, which will tell it to connect to the jtag and log the result of the connection

Jtag.Connect();


            if (Jtag.activeConnection)
            {
                Log.Text = ("Connected");


            }
            else
            {
                Log.Text = ("Failed, Check your plugin's on your jtag and your connection to the internet and to xbox 360 neighbourhood.");
            }


7) Now you have an XRPC program that should connect to your jtag! Well done! I ussually design a layout of a program before i put my codes, in so now design your layout, this is what mine looks like:

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]

8) Now we can start adding our codes it is pretty straight forward, Just do it like you did the connection code, If you need codes just check out this thread, i am going to keep updating it with every c# code i can find and i urge you to do the same, any useful codes posted will go on the thread with credit to the poster!

Codes!

Connecting:
Jtag.Connect();

Calling (This example calls SV_GameSendServerCommand):

Jtag.Call(0x82254940, 0, 0, "g \"XRPC\"");

Notification Messages:

Jtag.Notify(XRPC.XNotifyLogo.DOUBLE_SIDED_HAMMER, "XRPC v2.0 by Godly!");


Hud Elem News Bar:

 Jtag.Call(0x82254940, -1, 0, "s loc_warnings 0");
         Jtag.Call(0x82254940, -1, 0, "s loc_warningsUI 0"); //disable unlocalized text
         uint elem = createElem(0);
         string elemtext = "" + textBox3.Text; //TEXT BOX HERE OR TAKE OUT THE "+" AND ADD TEXT INTO THE SPEECH MARKS
         setText(elem, uintBytes(createText(elemtext)), 1, 20, 330, 0, 1);
         spawnElem(0, elem); //send text
         uint elemshader = createElem(0);
         uint shader = getMaterialIndex("black");
         setIcon(elemshader, shader, 1000, 23, 250, 0, 1);
         spawnElem(0, elemshader); //sent black shader
      }
      public static class HElems
      {
         public static uint
         locString = 0x8220C838,
         material = 0x8220C9F8,
         elem = 0x821DF9C0,
         xOffset = 0x08,
         yOffset = 0x04,
         textOffset = 0x84,
         fontOffset = 0x28,
         fontSizeOffset = 0x14,
         colorOffset = 0x34,
         relativeOffset = 0x2c,
         widthOffset = 0x48,
         heightOffset = 0x44,
         shaderOffset = 0x4C,
         alignOffset = 0x30;
      }
      public uint createElem(int client)
      {
         return Jtag.Call(HElems.elem, client, 0);
      }
      public uint spawnElem(int client, uint elemAddress)
      {
         Jtag.SetMemory(elemAddress + 0xA8, ReverseBytes(BitConverter.GetBytes(client)));
         return elemAddress;
      }
      public uint createText(string text)
      {
         return Jtag.Call(HElems.locString, text);
      }
      public uint getMaterialIndex(string material)
      {
         return Jtag.Call(HElems.material, material);
      }
      public byte[] uintBytes(uint input)
      {
         byte[] data = BitConverter.GetBytes(input);
         Array.Reverse(data);
         return data;
      }
      public byte[] ReverseBytes(byte[] inArray)
      {
         byte temp;
         int highCtr = inArray.Length - 1;
         for (int ctr = 0; ctr < inArray.Length / 2; ctr++)
         {
            temp = inArray[ctr];
            inArray[ctr] = inArray[highCtr];
            inArray[highCtr] = temp;
            highCtr -= 1;
         }
         return inArray;
      }
      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)
      {
         Jtag.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });
         Jtag.SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
         Jtag.SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
         Jtag.SetMemory(elem + HElems.shaderOffset, uintBytes(shader));
         Jtag.SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
         Jtag.SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
         Jtag.SetMemory(elem + HElems.alignOffset, uintBytes(align));
         Jtag.SetMemory(elem + HElems.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
         Jtag.SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
         Jtag.SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
      }
      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)
      {
         Jtag.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });
         Jtag.SetMemory(elem + HElems.textOffset, text);
         Jtag.SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
         Jtag.SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
         Jtag.SetMemory(elem + HElems.fontOffset, uintBytes(font));
         Jtag.SetMemory(elem + HElems.alignOffset, uintBytes(align));
         Jtag.SetMemory(elem + HElems.textOffset + 4, new byte[] { 0x40, 0x00 });
         Jtag.SetMemory(elem + HElems.fontSizeOffset, ReverseBytes(BitConverter.GetBytes(fontScale)));
         Jtag.SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
         Jtag.SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));


Adding Text in In the centre of the screen :



Jtag.Call(0x82254940, -1, 0, "c YourTextHere ");

OR
Jtag.Call(0x82254940, -1, 0, "c " + textbox1.text);



Adding Text in Killfeed:


Jtag.Call(0x82254940, -1, 0, "f YourTextHere ");
 

OR
Jtag.Call(0x82254940, -1, 0, "f " + textBox2.Text);


GiveWeapon:

uint weapIndex = Jtag.Call(0x82210640, "ak47_mp"); //any _mp
uint pstate = 0x830CBF80;
uint ent = 0x82F03600;
Jtag.Call(0x82210BC8, pstate, weapIndex, 0, 0);
Jtag.Call(0x821D4A00, ent, weapIndex, 0, 0);



Im going out but thought i would post this any way i will add more codes later, Sorry theres not many yet but there will be more! You can find some if you google them! Please anyone that has some good ones post them below! Thanks all
#2. Posted:
4GEE-Mobile
  • Junior Member
Status: Offline
Joined: Dec 22, 201211Year Member
Posts: 98
Reputation Power: 4
Status: Offline
Joined: Dec 22, 201211Year Member
Posts: 98
Reputation Power: 4
You basically merged Hugh's and godly' s tut together ...


Also Hugh's is better nuf said ....
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.