Advertisement
BaSs_HaXoR

Mw3 RPC Class

Sep 28th, 2014
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 22.62 KB | None | 0 0
  1.          
  2. //ORIGINAL SOURCE: http://pastebin.com/2bWDX4E6#
  3.  
  4.   //Mw3 RPC Class
  5.             public static class RPC
  6.             {
  7.                 #region RPC
  8.                 public static uint func_address = 0x0277208; //FPS Address 1.24
  9.                 /*
  10.                  * MW3 FPS RPC by VezahMoDz!
  11.                  * This function get written at the FPS Offset!
  12.                  *
  13.                      lis r28, 0x1005
  14.                      lwz r12, 0x48(r28)
  15.                      cmpwi r12, 0
  16.                      beq loc_277290
  17.                      lwz r3, 0x00(r28)
  18.                      lwz r4, 0x04(r28)
  19.                      lwz r5, 0x08(r28)
  20.                      lwz r6, 0x0C(r28)
  21.                      lwz r7, 0x10(r28)
  22.                      lwz r8, 0x14(r28)
  23.                      lwz r9, 0x18(r28)
  24.                      lwz r10, 0x1C(r28)
  25.                      lwz r11, 0x20(r28)
  26.                      lfs f1, 0x24(r28)
  27.                      lfs f2, 0x28(r28)
  28.                      lfs f3, 0x2C(r28)
  29.                      lfs f4, 0x30(r28)
  30.                      lfs f5, 0x34(r28)
  31.                      lfs f6, 0x38(r28)
  32.                      lfs f7, 0x3C(r28)
  33.                      lfs f8, 0x40(r28)
  34.                      lfs f9, 0x44(r28)
  35.                      mtctr r12
  36.                      bctrl
  37.                      li r4, 0
  38.                      stw r4, 0x48(r28)
  39.                      stw r3, 0x4C(r28)
  40.                      stfs f1, 0x50(r28)
  41.                      b loc_277290
  42.                  */
  43.                 public static uint GetFuncReturn()
  44.                 {
  45.                     byte[] ret = new byte[4];
  46.                     GetMemoryR(0x114AE64, ref ret);
  47.                     Array.Reverse(ret);
  48.                     return BitConverter.ToUInt32(ret, 0);
  49.                 }
  50.                 private static void GetMemoryR(uint Address, ref byte[] Bytes)
  51.                 {
  52.                     PS3.GetMemory(Address, Bytes);
  53.                 }
  54.                 public static void Enable()
  55.                 {
  56.                     if (PS3.Extension.ReadByte(0x27720C) == 0x80)
  57.                     {
  58.                         byte[] WritePPC = new byte[] {0x3F,0x80,0x10,0x05,0x81,0x9C,0x00,0x48,0x2C,0x0C,0x00,0x00,0x41,0x82,0x00,0x78,
  59.                                         0x80,0x7C,0x00,0x00,0x80,0x9C,0x00,0x04,0x80,0xBC,0x00,0x08,0x80,0xDC,0x00,0x0C,
  60.                                         0x80,0xFC,0x00,0x10,0x81,0x1C,0x00,0x14,0x81,0x3C,0x00,0x18,0x81,0x5C,0x00,0x1C,
  61.                                         0x81,0x7C,0x00,0x20,0xC0,0x3C,0x00,0x24,0xC0,0x5C,0x00,0x28,0xC0,0x7C,0x00,0x2C,
  62.                                         0xC0,0x9C,0x00,0x30,0xC0,0xBC,0x00,0x34,0xC0,0xDC,0x00,0x38,0xC0,0xFC,0x00,0x3C,
  63.                                         0xC1,0x1C,0x00,0x40,0xC1,0x3C,0x00,0x44,0x7D,0x89,0x03,0xA6,0x4E,0x80,0x04,0x21,
  64.                                         0x38,0x80,0x00,0x00,0x90,0x9C,0x00,0x48,0x90,0x7C,0x00,0x4C,0xD0,0x3C,0x00,0x50,
  65.                                         0x48,0x00,0x00,0x14};
  66.                         PS3.SetMemory(func_address, new byte[] { 0x41 });
  67.                         PS3.SetMemory(func_address + 4, WritePPC);
  68.                         PS3.SetMemory(func_address, new byte[] { 0x40 });
  69.                         Thread.Sleep(10);
  70.                         RPC.DestroyAll();
  71.                     }
  72.                     else
  73.                     {
  74.                     }
  75.                 }
  76.                 public static Int32 Call(UInt32 address, params Object[] parameters)
  77.                 {
  78.                     Int32 length = parameters.Length;
  79.                     Int32 index = 0;
  80.                     UInt32 count = 0;
  81.                     UInt32 Strings = 0;
  82.                     UInt32 Single = 0;
  83.                     UInt32 Array = 0;
  84.                     while (index < length)
  85.                     {
  86.                         if (parameters[index] is Int32)
  87.                         {
  88.                             PS3.Extension.WriteInt32(0x10050000 + (count * 4), (Int32)parameters[index]);
  89.                             count++;
  90.                         }
  91.                         else if (parameters[index] is UInt32)
  92.                         {
  93.                             PS3.Extension.WriteUInt32(0x10050000 + (count * 4), (UInt32)parameters[index]);
  94.                             count++;
  95.                         }
  96.                         else if (parameters[index] is Int16)
  97.                         {
  98.                             PS3.Extension.WriteInt16(0x10050000 + (count * 4), (Int16)parameters[index]);
  99.                             count++;
  100.                         }
  101.                         else if (parameters[index] is UInt16)
  102.                         {
  103.                             PS3.Extension.WriteUInt16(0x10050000 + (count * 4), (UInt16)parameters[index]);
  104.                             count++;
  105.                         }
  106.                         else if (parameters[index] is Byte)
  107.                         {
  108.                             PS3.Extension.WriteByte(0x10050000 + (count * 4), (Byte)parameters[index]);
  109.                             count++;
  110.                         }
  111.                         else
  112.                         {
  113.                             UInt32 pointer;
  114.                             if (parameters[index] is String)
  115.                             {
  116.                                 pointer = 0x10052000 + (Strings * 0x400);
  117.                                 PS3.Extension.WriteString(pointer, Convert.ToString(parameters[index]));
  118.                                 PS3.Extension.WriteUInt32(0x10050000 + (count * 4), pointer);
  119.                                 count++;
  120.                                 Strings++;
  121.                             }
  122.                             else if (parameters[index] is Single)
  123.                             {
  124.                                 WriteSingle(0x10050024 + (Single * 4), (Single)parameters[index]);
  125.                                 Single++;
  126.                             }
  127.                             else if (parameters[index] is Single[])
  128.                             {
  129.                                 Single[] Args = (Single[])parameters[index];
  130.                                 pointer = 0x10051000 + Array * 4;
  131.                                 WriteSingle(pointer, Args);
  132.                                 PS3.Extension.WriteUInt32(0x10050000 + count * 4, pointer);
  133.                                 count++;
  134.                                 Array += (UInt32)Args.Length;
  135.                             }
  136.  
  137.                         }
  138.                         index++;
  139.                     }
  140.                     PS3.Extension.WriteUInt32(0x10050048, address);
  141.                     Thread.Sleep(20);
  142.                     return PS3.Extension.ReadInt32(0x1005004c);
  143.                 }
  144.                 public static void DestroyAll()
  145.                 {
  146.                     Byte[] clear = new Byte[0xB4 * 1024];
  147.                     PS3.SetMemory(0xF0E10C, clear);
  148.                 }
  149.                 #endregion
  150.                 #region WriteSingle & ReverseBytes [Needed For RPC]
  151.                     public static void WriteSingle(uint address, float[] input)
  152.                     {
  153.                         int length = input.Length;
  154.                         byte[] array = new byte[length * 4];
  155.                         for (int i = 0; i < length; i++)
  156.                         {
  157.                             ReverseBytes(BitConverter.GetBytes(input[i])).CopyTo(array, (int)(i * 4));
  158.                         }
  159.                         PS3.SetMemory(address, array);
  160.                     }
  161.                     public static void WriteSingle(uint address, float input)
  162.                     {
  163.                         byte[] numArray = new byte[4];
  164.                         BitConverter.GetBytes(input).CopyTo(numArray, 0);
  165.                         Array.Reverse(numArray, 0, 4);
  166.                         PS3.SetMemory(address, numArray);
  167.                     }
  168.                     private static byte[] ReverseBytes(byte[] inArray)
  169.                     {
  170.                         Array.Reverse(inArray);
  171.                         return inArray;
  172.                     }
  173.                 #endregion
  174.                 #region Clone Player
  175.                 public static void clonePlayer(Int32 client)
  176.                 {
  177.                     RPC.Call(0x180F48, new Object[] { client << 16 });
  178.                 }
  179.                 #endregion
  180.                 #region PlayerFX
  181.                 public static uint PlayFX(float[] Origin, int EffectIndex)
  182.                 {
  183.                     uint ent = (uint)RPC.Call(0x1C0B7C, Origin, 0x56); //G_Temp
  184.                     PS3.Extension.WriteInt32(ent + 0xA0, EffectIndex);
  185.                     PS3.Extension.WriteInt32(ent + 0xD8, 0);
  186.                     PS3.Extension.WriteFloat(ent + 0x40, 0f);
  187.                     PS3.Extension.WriteFloat(ent + 0x44, 0f);
  188.                     PS3.Extension.WriteFloat(ent + 0x3C, 270f);
  189.                     return ent;
  190.                 }
  191.                 #endregion
  192.                 #region Cbuf_AddText
  193.                 public static void CBuf_AddText(int client, string command)
  194.                 {
  195.                     Call(Addresses.CBuf_AddText, (uint) client,command);
  196.                 }
  197.                 #endregion
  198.                 #region SV_GameSendServerCommand
  199.                 public static void SV_GameSendServerCommand(int client, string command)
  200.                 {
  201.                     Call(Addresses.SV_GameSendServerCommand, (uint)client, 0,command);
  202.                 }
  203.                 #endregion
  204.                 #region iPrintln
  205.                 public static void iPrintln(int client, string Text)
  206.                 {
  207.                     SV_GameSendServerCommand(client, "f \"" + Text + "\"");
  208.                     Thread.Sleep(20);
  209.                 }
  210.                 #endregion
  211.                 #region iPrintlnBold
  212.                 public static void iPrintlnBold(int client, string Text)
  213.                 {
  214.                     SV_GameSendServerCommand(client, "c \"" + Text + "\"");
  215.                     Thread.Sleep(20);
  216.                 }
  217.                 #endregion
  218.                 #region Set_ClientDvar
  219.                 public static void Set_ClientDvar(int client, string Text)
  220.                 {
  221.                     SV_GameSendServerCommand(client, "q \"" + Text + "\"");
  222.                     Thread.Sleep(20);
  223.                 }
  224.                 #endregion
  225.                 #region Fov
  226.                 public static void Fov(int client, string Text)
  227.                 {
  228.                     SV_GameSendServerCommand(client, "q \"cg_fov \"" + Text + "\"");
  229.                     Thread.Sleep(20);
  230.                 }
  231.                 #endregion
  232.                 #region Vision
  233.                 public static void Vision(int client, string Text)
  234.                 {
  235.                     SV_GameSendServerCommand(client, "J \"" + Text + "\"");
  236.                     Thread.Sleep(20);
  237.                 }
  238.                 #endregion
  239.                 #region KickWithError
  240.                 public static void Kick(int client, string Text)
  241.                 {
  242.                     SV_GameSendServerCommand(client, "r \"" + Text + "\"");
  243.                     Thread.Sleep(20);
  244.                 }
  245.                 #endregion
  246.                 #region GiveWeapon
  247.                 public static void GiveWeapon(int client, int weapon,int akimbo)
  248.                 {
  249.                     Call(Addresses.G_GivePlayerWeapon, (uint)G_ClientFunction(client), (uint)weapon, 0);
  250.                     Call(Addresses.Add_Ammo, (uint)(Addresses.G_Entity + (client * 0x280)), (uint)weapon, 0, 9999, 1);
  251.                 }
  252.                 #endregion
  253.                 #region G_ClientFunction
  254.                 public static uint G_ClientFunction(int client)
  255.                 {
  256.                     return Addresses.G_Client + ((uint)client * 0x3980);
  257.                 }
  258.                 #endregion
  259.                 #region SetModel
  260.                 public static void SetModel(int client, string model)
  261.                 {
  262.                     Call(Addresses.G_SetModel, (uint)(Addresses.G_Entity + (client * 640)), model);
  263.                 }
  264.                 #endregion
  265.                 #region Cmd_ExecuteSingleCommand
  266.                 public static void Cmd_ExecuteSingleCommand(uint client, string command)
  267.                 {
  268.                     Call(Addresses.Cmd_ExecuteSingleCommand, (uint)client, command);
  269.                 }
  270.                 #endregion
  271.                 #region G_EntityFunction
  272.                 public static UInt32 G_EntityFunction(Int32 clientIndex, UInt32 Mod = 0)
  273.                 {
  274.                     return ((0xfca280 + Mod) + ((UInt32)(0x280 * clientIndex)));
  275.                 }
  276.                 #endregion
  277.                 #region GiveWeapon
  278.                 public static void G_GivePlayerWeapon(int client,int ammo, int weapon, int akimbo)
  279.                 {
  280.                     for (int i = 0; i < 18; i++)
  281.                     {
  282.                         long GClients = Addresses.G_Client + (i * 0x3980);
  283.                         Call(Addresses.G_GivePlayerWeapon, GClients, (uint)weapon, akimbo);
  284.                         Call(Addresses.Add_Ammo, (uint)(Addresses.G_Entity + (i * 640)), (uint)weapon, 0, ammo, 1);
  285.                         Call(Addresses.SV_GameSendServerCommand, i, 0, "a \"" + weapon + "\"");
  286.                     }
  287.                     long GClient = Addresses.G_Client + (client * 0x3980);
  288.                     Call(Addresses.G_GivePlayerWeapon, GClient, (uint)weapon, akimbo);
  289.                     Call(Addresses.Add_Ammo, (uint)(Addresses.G_Entity + (client * 0x280)), (uint)weapon, 0, ammo, 1);
  290.                     Call(Addresses.SV_GameSendServerCommand, client, 0, "a \"" + weapon + "\"");
  291.                 }
  292.                 #endregion
  293.             }
  294.                 #region Addresses
  295.                 public static class Addresses
  296.                 {
  297.                     public static uint
  298.                        G_Client = 0x110A280,
  299.                        g_client = 0x110A280,
  300.                        G_ClientIndex = 0x3980,
  301.                        EntityIndex = 0x280,
  302.                        G_Entity = 0xFCA280,
  303.                        MapBrushModel = 0x7F80,
  304.                        BG_GetPerkIndexForName = 0x210B0,
  305.                        BG_GetNumWeapons = 0x3CFBC,
  306.                        BG_FindWeaponIndexForName = 0x3CFD0,
  307.                        BG_GetWeaponIndexForName = 0x3D434,
  308.                        BG_GetViewModelWeaponIndex = 0x3D7D8,
  309.                        Cmd_ExecuteSingleCommand = 0x1DB240,
  310.                        BG_WeaponFireRecoil = 0x3FBD0,
  311.                        CG_FireWeapon = 0xBE498,
  312.                        Key_IsDown = 0xD1CD8,
  313.                        Key_StringToKeynum = 0xD1D18,
  314.                        Key_IsValidGamePadChar = 0xD1E64,
  315.                        Key_KeyNumToString = 0xD1EA4,
  316.                        Key_Unbind_f = 0xD2368,
  317.                        Key_Bind_f = 0xD247C,
  318.                        BG_TakePlayerWeapon = 0x1C409C,
  319.                        G_GivePlayerWeapon = 0x1C3034,
  320.                        SV_GameSendServerCommand = 0x228FA8,
  321.                        SV_GetConfigString = 0x22A4A8,
  322.                        SV_SetConfigString = 0x22A208,
  323.                        va = 0x299490,
  324.                        G_SetModel = 0x1BEF5C,
  325.                        G_LocalizedStringIndex = 0x1BE6CC,
  326.                        G_MaterialIndex = 0x1BE744,
  327.                        G_ModelIndex = 0x1BE7A8,
  328.                        G_ModelName = 0x1BE8A0,
  329.                        Add_Ammo = 0x18A29C,
  330.                        PlayerCmd_SetPerk = 0x17EBE8,
  331.                        G_Damage = 0x183E18,
  332.                        G_RadiusDamage = 0x185600,
  333.                        G_GetClientScore = 0x18EA74,
  334.                        G_GetClientDeaths = 0x18EA98,
  335.                        Cmd_AddCommandInternal = 0x1DC4FC,
  336.                        CBuf_AddText /*(int localClientNum, const char *text)*/ = 0x001DB240,
  337.                        SV_SendDisconnect /*(client_s *client, int state, const char *reason)*/ = 0x0022472C,
  338.                        SV_SendClientGameState /*(client_s *client)*/ = 0x002284F8,
  339.                        SV_KickClient /*(client_s *cl, char *playerName, int maxPlayerNameLen)*/ = 0x00223BD0,
  340.                        G_CallSpawnEntity /*(gentity_s *ent)*/ = 0x001BA730,
  341.                        Player_Die /*(unsigned int *self, unsigned int *inflictor, unsigned int *attacker, int damage, int meansOfDeath, int iWeapon, const float *vDir, unsigned int hitLoc, int psTimeOffset)*/  = 0x00183748,
  342.                        SV_DropClient /*(client_s *drop, const char *reason, bool tellThem)*/ = 0x002249FC,
  343.                        SV_SendServerCommand /*(client_s *,svscmd_type,char const *,...)*/ = 0x0022CEBC,
  344.                        Scr_Notify /*(gentity_s *ent, unsigned __int16 stringValue, unsigned int paramcount)*/ = 0x001BB1B0,
  345.                        Sv_SetGametype /*(void)*/ = 0x00229C1C,
  346.                        Sv_Maprestart /*(int fast_restart)*/ = 0x00223774,
  347.                        sv_maprestart_f = 0x00223B20,
  348.                        sv_spawnsever /*(const char *server)*/ = 0x0022ADF8,
  349.                        sv_map_f = 0x002235A0,
  350.                        sv_matchend /*(void)*/ = 0x0022F7A8,
  351.                        R_AddCmdDrawText /*(const char *text, int maxChars, void *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style)*/ = 0x00393640,
  352.                        R_RegisterFont /*(char* asset, int imagetrack)*/ /*(const char *name, int imageTrack)*/ = 0x003808B8,
  353.                        R_AddCmdDrawStretchPic /*(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, int material)*/ = 0x00392D78,
  354.                        CL_DrawTextHook /*(const char *text, int maxChars, void *font, float x, float y, float xScale, float yScale, const float *color, int style)*/ = 0x000D93A8,
  355.                        R_AddCmdDrawTextWithEffects /*(char const *,int,Font_s *,float,float,float,float,float,float const * const,int,float const * const,Material *,Material *,int,int,int,int)*/ = 0x003937C0,
  356.                        CG_BoldGameMessage /*(int LocalClientNum, const char *Message)*/ = 0x0007A5C8,
  357.                        UI_FillRectPhysical /*(float x, float y, float width, float height, const float *color)*/ = 0x0023A810,
  358.                        UI_DrawLoadBar /*(ScreenPlacement *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Material *material)*/ = 0x0023A730,
  359.                        Scr_MakeGameMessage /*(int iClientNum, const char *pszCmd)*/ = 0x001B07F0,
  360.                        Scr_ConstructMessageString /*(int firstParmIndex, int lastParmIndex, const char *errorContext, char *string, unsigned int stringLimit)*/ = 0x001B04F4,
  361.                        R_NormalizedTextScale /*(Font_s *font, float scale)*/ = 0x003808F0,
  362.                        TeleportPlayer /*(gentity_s *player, float *origin, float *angles)*/ = 0x00191B00,
  363.                        CL_DrawText /*(ScreenPlacement *scrPlace, const char *text, int maxChars, Font_s *font, float x, float y, int horzAlign, int vertAlign, float xScale, float yScale, const float *color, int style)*/ = 0x000D9490,
  364.                        CL_DrawTextRotate /*(ScreenPlacement *scrPlace, const char *text, int maxChars, Font_s *font, float x, float y, float rotation, int horzAlign, int vertAlign, float xScale, float yScale, const float *color, int style)*/ = 0x000D9554,
  365.                        SV_GameDropClient /*(int clientNum, const char *reason)*/ = 0x00229020,
  366.                        Dvar_GetBool /*(const char *dvarName)*/ = 0x00291060,
  367.                        Dvar_GetInt /*(const char *dvarName)*/ = 0x002910DC,
  368.                        Dvar_GetFloat /*(const char *dvarName)*/ = 0x00291148,
  369.                        Dvar_RegisterBool /*(const char *dvarName, bool value, unsigned __int16 flags, const char *description)*/ = 0x002933F0,
  370.                        Dvar_IsValidName /*(const char *dvarName)*/ = 0x0029019C,
  371.                        Material_RegisterHandle /*(const char *name, int imageTrack)*/ = 0x0038B044,
  372.                        CL_RegisterFont /*(const char *fontName, int imageTrack)*/ = 0x000D9734,
  373.                        SetClientViewAngle /*(gentity_s *ent, const float *angle)*/ = 0x001767E0,
  374.                        R_RegisterDvars /*(void)*/ = 0x0037E420,
  375.                        PlayerCmd_SetClientDvar /*(scr_entref_t entref)*/ = 0x0017CB4C,
  376.                        Jump_RegisterDvars /*(void)*/ = 0x00018E20,
  377.                        AimTarget_RegisterDvars = 0x00012098,
  378.                        G_FreeEntity /*(gentity_s *ed)*/ = 0x001C0840,
  379.                        G_EntUnlink /*(gentity_s *ent)*/ = 0x001C4A5C,
  380.                        SV_DObjGetTree /*(gentity_s *ent)*/ = 0x00229A68,
  381.                        BG_GetEntityTypeName /*(const int eType)*/ = 0x0001D1F0,
  382.                        CL_GetClientState /*(int localClientNum, uiClientState_s *state)*/ = 0x000E26A8,
  383.                         CL_GetConfigString /*(int localClientNum, int configStringIndex)*/ = 0x000C5E7C,
  384.                        Info_ValueForKey /*(const char *s, const char *key)*/ = 0x00299604,
  385.                        Scr_GetInt /*(unsigned int index)*/ = 0x002201C4,
  386.                        ClientSpawn /*(gentity_s *ent, const float *spawn_origin, const float *spawn_angles)*/ = 0x00177468,
  387.                        Sv_ClientCommand /*(client_s *cl, msg_t *msg)*/ = 0x00228178,
  388.                        Sv_ExecuteClientMessage /*(client_s *cl, msg_t *msg)*/ = 0x00228B50,
  389.                        Sv_ExecuteClientCommand /*(client_s *cl, const char *s, int clientOK)*/ = 0x00182DEC,
  390.                        ClientCommand /*(int clientNum)*/ = 0x00182440,
  391.                        CalculateRanks /*(void)*/ = 0x0019031C,
  392.                        ClientScr_SetScore /*(gclient_s *pSelf, client_fields_s *pField)*/ = 0x00176150,
  393.                        ClientScr_SetMaxHealth /*(gclient_s *pSelf, client_fields_s *pField)*/ = 0x00176094,
  394.                        Sv_ReceiveStats /*(netadr_t from, msg_t *msg)*/ = 0x002244E0,
  395.                        ClientConnect /*(int clientNum, unsigned __int16 scriptPersId)*/ = 0x001771A0,
  396.                        Sv_DirectConnect /*(netadr_t from)*/ = 0x00255BB4,
  397.                        Sv_SetConfigstring /*(int index, const char *val)*/ = 0x0022A208,
  398.                        Sv_AddServerCommand /*(client_s *client, svscmd_type type, const char *cmd)*/ = 0x0022CBA0,
  399.                        IntermissionClientEndFrame /*(gentity_s *ent)*/ = 0x001745F8,
  400.                        memset = 0x0049B928,
  401.                        str_pointer = 0x523b30,
  402.                        g_gametype = 0x8360d5;
  403.                 }
  404.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement