Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ----------------------------------------------------------------------------------- */
- // MW2 CEX / DEX compatible RPC (Remote Procedure Calls) .cs Source //
- /* ----------------------------------------------------------------------------------- */
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using PS3Lib;
- using System.Threading;
- namespace Yourprogram
- {
- /* ----------------------------------------------------------------------------------- */
- /*
- Yb dP 8 w .d88b. w w dP"Yb
- Yb db dP 8d8b. .d88 w8ww YPwww. .d88b .d8b 8 8 8d8b w w8ww Yb dP " d8
- YbdPYbdP 8P Y8 8 8 8 d8 8.dP' 8 8b d8 8P 8 8 YbdP dP
- YP YP 8 8 `Y88 Y8P `Y88P' `Y88P `Y8P `Y8P8 8 8 Y8P dP w
- dP x
- */
- //BaSs_HaXoR was here.
- class CDRPC
- {
- public static PS3API PS3 = new PS3API(SelectAPI.ControlConsole);
- public static uint fxBirthTime = 0x90;
- public static uint fxDecayDuration = 0x9c;
- public static uint fxDecayStartTime = 0x98;
- public static uint fxLetterTime = 0x94;
- private static uint function_address = 0x38EDE8;
- public static int Call(UInt32 func_address, params object[] parameters)
- {
- int length = parameters.Length;
- int index = 0;
- UInt32 num3 = 0;
- UInt32 num4 = 0;
- UInt32 num5 = 0;
- UInt32 num6 = 0;
- while (index < length)
- {
- if (parameters[index] is int)
- {
- PS3.Extension.WriteInt32(0x10050000 + (num3 * 4), (int)parameters[index]);
- num3++;
- }
- else if (parameters[index] is UInt32)
- {
- PS3.Extension.WriteUInt32(0x10050000 + (num3 * 4), (UInt32)parameters[index]);
- num3++;
- }
- else
- {
- UInt32 num7;
- if (parameters[index] is string)
- {
- num7 = 0x10052000 + (num4 * 0x400);
- PS3.Extension.WriteString(num7, Convert.ToString(parameters[index]));
- PS3.Extension.WriteUInt32(0x10050000 + (num3 * 4), num7);
- num3++;
- num4++;
- }
- else if (parameters[index] is float)
- {
- PS3.Extension.WriteFloat(0x10050024 + (num5 * 4), (float)parameters[index]);
- num5++;
- }
- else if (parameters[index] is float[])
- {
- float[] input = (float[])parameters[index];
- num7 = 0x10051000 + (num6 * 4);
- CDRPC.WriteSingle(num7, input);
- PS3.Extension.WriteUInt32(0x10050000 + (num3 * 4), num7);
- num3++;
- num6 += (UInt32)input.Length;
- }
- }
- index++;
- }
- PS3.Extension.WriteUInt32(0x1005004C, func_address);
- Thread.Sleep(20);
- return PS3.Extension.ReadInt32(0x10050050);
- }
- public static void EnableRPC()
- {
- byte[] RPC = { 0xF8, 0x21, 0xFF, 0x91, 0x7C, 0x08, 0x02, 0xA6, 0xF8, 0x01, 0x00, 0x80, 0x3C, 0x40, 0x00, 0x72, 0x30, 0x42, 0x4C, 0x38, 0x3C, 0x60, 0x10, 0x05, 0x81, 0x83, 0x00, 0x4C, 0x2C, 0x0C, 0x00, 0x00, 0x41, 0x82, 0x00, 0x64, 0x80, 0x83, 0x00, 0x04, 0x80, 0xA3, 0x00, 0x08, 0x80, 0xC3, 0x00, 0x0C, 0x80, 0xE3, 0x00, 0x10, 0x81, 0x03, 0x00, 0x14, 0x81, 0x23, 0x00, 0x18, 0x81, 0x43, 0x00, 0x1C, 0x81, 0x63, 0x00, 0x20, 0xC0, 0x23, 0x00, 0x24, 0xC0, 0x43, 0x00, 0x28, 0xC0, 0x63, 0x00, 0x2C, 0xC0, 0x83, 0x00, 0x30, 0xC0, 0xA3, 0x00, 0x34, 0xC0, 0xC3, 0x00, 0x38, 0xC0, 0xE3, 0x00, 0x3C, 0xC1, 0x03, 0x00, 0x40, 0xC1, 0x23, 0x00, 0x48, 0x80, 0x63, 0x00, 0x00, 0x7D, 0x89, 0x03, 0xA6, 0x4E, 0x80, 0x04, 0x21, 0x3C, 0x80, 0x10, 0x05, 0x38, 0xA0, 0x00, 0x00, 0x90, 0xA4, 0x00, 0x4C, 0x90, 0x64, 0x00, 0x50, 0x3C, 0x40, 0x00, 0x73, 0x30, 0x42, 0x4B, 0xE8, 0xE8, 0x01, 0x00, 0x80, 0x7C, 0x08, 0x03, 0xA6, 0x38, 0x21, 0x00, 0x70, 0x4E, 0x80, 0x00, 0x20 };
- PS3.SetMemory(function_address, RPC);
- PS3.SetMemory(0x10050000, new byte[0x2854]);
- }
- public class HudStruct
- {
- public static uint
- xOffset = 0x08,
- yOffset = 0x04,
- textOffset = 0x84,
- GlowColor = 0x8C,
- fxBirthTime = 0x90,
- fxLetterTime = 0x94,
- fadeStartTime = 0x3C,
- fadeTime = 0x40,
- fromColor = 0x38,
- fxDecayStartTime = 0x98,
- fxDecayDuration = 0x9C,
- fontOffset = 0x28,
- fontSizeOffset = 0x14,
- colorOffset = 0x34,
- scaleStartTime = 0x58,
- fromFontScale = 0x18,
- fontScaleTime = 0x20,
- relativeOffset = 0x2c,
- widthOffset = 0x48,
- heightOffset = 0x44,
- shaderOffset = 0x4C,
- alignOffset = 0x30,
- fromAlignOrg = 0x68,
- fromAlignScreen = 0x6C,
- alignOrg = 0x2C,
- alignScreen = 0x30,
- fromY = 0x60,
- fromX = 0x64,
- moveStartTime = 0x70,
- moveTime = 0x74,
- flags = 0xA4,
- clientIndex = 0xA8;
- }
- public static class HudAlloc
- {
- public static uint
- IndexSlot = 50,
- g_hudelem = 0x012E9858;
- public static bool
- Start = true;
- }
- public static class HUDAlign
- {
- public static uint
- RIGHT = 2,
- CENTER = 5,
- LEFT = 1;
- }
- public class HudTypes
- {
- public static uint
- Text = 1,
- Shader = 6,
- Null = 0;
- }
- public static void ChangeFont(uint elem, uint font)
- {
- PS3.Extension.WriteUInt32(elem + HudStruct.fontOffset, font);
- }
- public class Material
- {
- public static uint
- White = 1,
- Black = 2,
- Prestige0 = 0x1A,
- Prestige1 = 0x1B,
- Prestige2 = 0x1C,
- Prestige3 = 0x1D,
- Prestige4 = 0x1E,
- Prestige5 = 0x1F,
- Prestige6 = 0x20,
- Prestige7 = 0x21,
- Prestige8 = 0x22,
- Prestige9 = 0x23,
- Prestige10 = 0x24,
- WhiteRectangle = 0x25,
- NoMap = 0x29;
- }
- public static int RGB2INT(int r, int g, int b, int a)
- {
- byte[] newRGB = new byte[4];
- newRGB[0] = (byte)r;
- newRGB[1] = (byte)g;
- newRGB[2] = (byte)b;
- newRGB[3] = (byte)a;
- Array.Reverse(newRGB);
- return BitConverter.ToInt32(newRGB, 0);
- }
- public static void SetText(uint clientIndex, uint elem, string text, uint font, float fontScale, float x, float y, uint alignText, uint align, int r = 255, int g = 255, int b = 255, int a = 255, int GlowR = 255, int GlowG = 0, int GlowB = 0, int GlowA = 0)
- {
- PS3.Extension.WriteInt32(elem, 0);
- PS3.Extension.WriteInt32(elem + HudStruct.flags, 1);
- PS3.Extension.WriteUInt32(elem + HudStruct.clientIndex, clientIndex);
- PS3.Extension.WriteUInt32(elem + HudStruct.textOffset, G_LocalizedString(text));
- PS3.Extension.WriteUInt32(elem + HudStruct.relativeOffset, alignText);
- PS3.Extension.WriteUInt32(elem + HudStruct.relativeOffset - 4, 6);
- PS3.Extension.WriteUInt32(elem + HudStruct.fontOffset, font);
- PS3.Extension.WriteUInt32(elem + HudStruct.alignOffset, align);
- PS3.Extension.WriteInt16(elem + HudStruct.textOffset + 4, 0x4000);
- PS3.Extension.WriteFloat(elem + HudStruct.fontSizeOffset, fontScale);
- PS3.Extension.WriteFloat(elem + HudStruct.xOffset, x);
- PS3.Extension.WriteFloat(elem + HudStruct.yOffset, y);
- PS3.Extension.WriteInt32(elem + HudStruct.colorOffset, RGB2INT(r, g, b, a));
- PS3.Extension.WriteInt32(elem + HudStruct.GlowColor, RGB2INT(GlowR, GlowG, GlowB, GlowA));
- setClientJustDvar((int)clientIndex, "loc_warnings 0");
- setClientJustDvar((int)clientIndex, "loc_warningsAsErrors 0");
- }
- public static void SetShader(uint clientIndex, uint elem, string 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)
- {
- PS3.Extension.WriteInt32(elem, 0);
- PS3.Extension.WriteInt32(elem + HudStruct.flags, 1);
- PS3.Extension.WriteUInt32(elem + HudStruct.clientIndex, clientIndex);
- PS3.Extension.WriteUInt32(elem + HudStruct.shaderOffset, G_MaterialIndex(shader));
- PS3.Extension.WriteUInt32(elem + HudStruct.relativeOffset, 5);
- PS3.Extension.WriteUInt32(elem + HudStruct.relativeOffset - 4, HUDAlign.RIGHT);
- PS3.Extension.WriteInt32(elem + HudStruct.heightOffset, height);
- PS3.Extension.WriteInt32(elem + HudStruct.alignOrg, 0);
- PS3.Extension.WriteInt32(elem + HudStruct.alignScreen, 0);
- PS3.Extension.WriteInt32(elem + HudStruct.widthOffset, width);
- PS3.Extension.WriteUInt32(elem + HudStruct.alignOffset, align);
- PS3.Extension.WriteFloat(elem + HudStruct.xOffset, x);
- PS3.Extension.WriteFloat(elem + HudStruct.yOffset, y);
- PS3.Extension.WriteInt32(elem + HudStruct.colorOffset, RGB2INT(r, g, b, a));
- PS3.Extension.WriteFloat(elem + HudStruct.textOffset + 4, sort);
- }
- public static void FadeOverTime(uint elem, int Time, int R, int G, int B, int A)
- {
- PS3.Extension.WriteInt32(elem + HudStruct.fadeStartTime, getLevelTime());
- PS3.Extension.WriteBytes(elem + HudStruct.fromColor, PS3.Extension.ReadBytes(elem + HudStruct.colorOffset, 4));
- PS3.Extension.WriteInt32(elem + HudStruct.fadeTime, Time);
- PS3.Extension.WriteInt32(elem + HudStruct.colorOffset, RGB2INT(R, G, B, A));
- }
- public static void FadeGlowOverTime(uint elem, int Time, int GlowR, int GlowG, int GlowB, int GlowA)
- {
- PS3.Extension.WriteInt32(elem + HudStruct.fadeStartTime, getLevelTime());
- PS3.Extension.WriteBytes(elem + HudStruct.fromColor, PS3.Extension.ReadBytes(elem + HudStruct.colorOffset, 4));
- PS3.Extension.WriteInt32(elem + HudStruct.fadeTime, Time);
- PS3.Extension.WriteInt32(elem + HudStruct.GlowColor, RGB2INT(GlowR, GlowG, GlowB, GlowA));
- }
- public static void MoveOverTime(uint elem, Int32 time, float x, float y)
- {
- PS3.Extension.WriteInt32(elem + HudStruct.fromAlignOrg, PS3.Extension.ReadInt32(elem + HudStruct.alignOrg));
- PS3.Extension.WriteInt32(elem + HudStruct.fromAlignScreen, PS3.Extension.ReadInt32(elem + HudStruct.alignScreen));
- PS3.Extension.WriteFloat(elem + HudStruct.fromY, PS3.Extension.ReadFloat(elem + HudStruct.yOffset));
- PS3.Extension.WriteFloat(elem + HudStruct.fromX, PS3.Extension.ReadFloat(elem + HudStruct.xOffset));
- PS3.Extension.WriteInt32(elem + HudStruct.moveStartTime, getLevelTime());
- PS3.Extension.WriteInt32(elem + HudStruct.moveTime, time);
- PS3.Extension.WriteFloat(elem + HudStruct.xOffset, x);
- PS3.Extension.WriteFloat(elem + HudStruct.yOffset, y);
- }
- public static void setPulseFX(uint elem, int speed, int decayStart, int decayDuration)
- {
- PS3.Extension.WriteInt32(elem + HudStruct.fxBirthTime, getLevelTime());
- PS3.Extension.WriteInt32(elem + HudStruct.fxLetterTime, speed);
- PS3.Extension.WriteInt32(elem + HudStruct.fxDecayStartTime, decayStart);
- PS3.Extension.WriteInt32(elem + HudStruct.fxDecayDuration, decayDuration);
- }
- public static void DestroyElem(uint elem)
- {
- PS3.SetMemory(elem, new byte[0xB4]);
- }
- public static void SetElement(uint Element, uint HudTypes)
- {
- PS3.Extension.WriteUInt32(Element, HudTypes);
- }
- public static uint HudElemAlloc(bool Reset = false)
- {
- if (Reset == true)
- HudAlloc.IndexSlot = 50;
- uint Output = HudAlloc.g_hudelem + (HudAlloc.IndexSlot * 0xB4);
- HudAlloc.IndexSlot++;
- return Output;
- }
- public static uint HudElemAlloc_Game(int clientNumber)
- {
- return (uint)Call(0x001806E0, clientNumber);
- }
- public static uint G_LocalizedString(string newText)
- {
- return (uint)Call(0x001BE7C8, newText);
- }
- public static uint G_MaterialIndex(string shader)
- {
- return (uint)Call(0x001BE758, shader);
- }
- public static Int32 getLevelTime()
- {
- return (Int32)PS3.Extension.ReadUInt32(0x12E0304);
- }
- private static byte[] ReverseBytes(byte[] inArray)
- {
- Array.Reverse(inArray);
- return inArray;
- }
- public static void WriteSingle(uint address, float[] input)
- {
- int length = input.Length;
- byte[] array = new byte[length * 4];
- for (int i = 0; i < length; i++)
- {
- ReverseBytes(BitConverter.GetBytes(input[i])).CopyTo(array, (int)(i * 4));
- }
- PS3.SetMemory(address, array);
- }
- public static void ChangeText(uint Element, string newText)
- {
- PS3.Extension.WriteUInt32(Element + HudStruct.textOffset, G_LocalizedString(newText));
- }
- public static UInt32 client_s(Int32 clientIndex)
- {
- return 0x34740000 + (0x97F80 * (UInt32)clientIndex);
- }
- public static UInt32 G_Entity(Int32 clientIndex)
- {
- return 0x1319800 + (0x280 * (UInt32)clientIndex);
- }
- public static UInt32 G_Client(Int32 clientIndex)
- {
- return 0x14E2200 + (0x3700 * (UInt32)clientIndex);
- }
- public class Buttons
- {
- public static string
- DpadUp = "+actionslot 1",
- DpadDown = "+actionslot 2",
- DpadRight = "+actionslot 4",
- DpadLeft = "+actionslot 3",
- Cross = "+gostand",
- Circle = "+stance",
- Triangle = "weapnext",
- Square = "+usereload",
- R3 = "+melee",
- R2 = "+frag",
- R1 = "+attack",
- L3 = "+breath_sprint",
- L2 = "+smoke",
- L1 = "+speed_throw",
- Select = "togglescores",
- Start = "togglemenu";
- }
- public static bool ButtonPressed(int client, string Button)
- {
- if (PS3.Extension.ReadString(0x34750E9F + ((uint)client * 0x97F80)) == Button)
- return true;
- else return false;
- }
- public static Boolean IsMW2()
- {
- foreach (String temp in new String[] { "BLUS30377", "BLKS20159", "BLES00683", "BLES00686", "BLES00685", "BLES00684", "BLES00687" })
- if (temp == PS3.Extension.ReadString(0x10010251))
- return true;
- return false;
- }
- public static void cBuff_AddText(int clientNum, string command)
- {
- Call(0x001D9EC0, clientNum, command);
- }
- public static void SV_GameSendServerCommand(Int32 clientIndex, String Cmd)
- {
- Call(0x0021A0A0, clientIndex, 0, Cmd);
- }
- public static void setClientDvar(int clientNumber, string dvar, string Val)
- {
- SV_GameSendServerCommand(clientNumber, "v " + dvar + " \"" + Val + "\"");
- }
- public static void setClientJustDvar(int clientNumber, string dvar)
- {
- SV_GameSendServerCommand(clientNumber, "v " + dvar);
- }
- public static void iPrintln(int clientNumber, string Txt)
- {
- SV_GameSendServerCommand(clientNumber, "f \"" + Txt + "\"");
- }
- public static void iPrintlnBold(int clientNumber, string Txt)
- {
- SV_GameSendServerCommand(clientNumber, "g \"" + Txt + "\"");
- }
- public static void playSound(int clientNumber, string soundName)
- {
- SV_GameSendServerCommand(clientNumber, "o \"" + soundName + "\"");
- }
- }
- }
- /* ----------------------------------------------------------------------------------- */
- //BaSs_HaXoR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement