Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Vezah FPS RPC
- public static uint func_address = 0x0277208; //FPS Address 1.24
- /*
- * MW3 FPS RPC by VezahHFH!
- * This function get written at the FPS Offset!
- *
- lis r28, 0x1005
- lwz r12, 0x48(r28)
- cmpwi r12, 0
- beq loc_277290
- lwz r3, 0x00(r28)
- lwz r4, 0x04(r28)
- lwz r5, 0x08(r28)
- lwz r6, 0x0C(r28)
- lwz r7, 0x10(r28)
- lwz r8, 0x14(r28)
- lwz r9, 0x18(r28)
- lwz r10, 0x1C(r28)
- lwz r11, 0x20(r28)
- lfs f1, 0x24(r28)
- lfs f2, 0x28(r28)
- lfs f3, 0x2C(r28)
- lfs f4, 0x30(r28)
- lfs f5, 0x34(r28)
- lfs f6, 0x38(r28)
- lfs f7, 0x3C(r28)
- lfs f8, 0x40(r28)
- lfs f9, 0x44(r28)
- mtctr r12
- bctrl
- li r4, 0
- stw r4, 0x48(r28)
- stw r3, 0x4C(r28)
- stfs f1, 0x50(r28)
- b loc_277290
- */
- public static uint GetFuncReturn()
- {
- byte[] ret = new byte[4];
- GetMemoryR(0x114AE64, ref ret);
- Array.Reverse(ret);
- return BitConverter.ToUInt32(ret, 0);
- }
- public static void Enable()
- {
- byte[] WritePPC = new byte[] {0x3F,0x80,0x10,0x05,0x81,0x9C,0x00,0x48,0x2C,0x0C,0x00,0x00,0x41,0x82,0x00,0x78,
- 0x80,0x7C,0x00,0x00,0x80,0x9C,0x00,0x04,0x80,0xBC,0x00,0x08,0x80,0xDC,0x00,0x0C,
- 0x80,0xFC,0x00,0x10,0x81,0x1C,0x00,0x14,0x81,0x3C,0x00,0x18,0x81,0x5C,0x00,0x1C,
- 0x81,0x7C,0x00,0x20,0xC0,0x3C,0x00,0x24,0xC0,0x5C,0x00,0x28,0xC0,0x7C,0x00,0x2C,
- 0xC0,0x9C,0x00,0x30,0xC0,0xBC,0x00,0x34,0xC0,0xDC,0x00,0x38,0xC0,0xFC,0x00,0x3C,
- 0xC1,0x1C,0x00,0x40,0xC1,0x3C,0x00,0x44,0x7D,0x89,0x03,0xA6,0x4E,0x80,0x04,0x21,
- 0x38,0x80,0x00,0x00,0x90,0x9C,0x00,0x48,0x90,0x7C,0x00,0x4C,0xD0,0x3C,0x00,0x50,
- 0x48,0x00,0x00,0x14};
- PS3.SetMemory(func_address, new byte[] { 0x41 });
- PS3.SetMemory(func_address + 4, WritePPC);
- PS3.SetMemory(func_address, new byte[] { 0x40 });
- Thread.Sleep(10);
- RPC.DestroyAll();
- }
- public static Int32 Call(UInt32 address, params Object[] parameters)
- {
- Int32 length = parameters.Length;
- Int32 index = 0;
- UInt32 count = 0;
- UInt32 Strings = 0;
- UInt32 Single = 0;
- UInt32 Array = 0;
- while (index < length)
- {
- if (parameters[index] is Int32)
- {
- PS3.Extension.WriteInt32(0x10050000 + (count * 4), (Int32)parameters[index]);
- count++;
- }
- else if (parameters[index] is UInt32)
- {
- PS3.Extension.WriteUInt32(0x10050000 + (count * 4), (UInt32)parameters[index]);
- count++;
- }
- else if (parameters[index] is Int16)
- {
- PS3.Extension.WriteInt16(0x10050000 + (count * 4), (Int16)parameters[index]);
- count++;
- }
- else if (parameters[index] is UInt16)
- {
- PS3.Extension.WriteUInt16(0x10050000 + (count * 4), (UInt16)parameters[index]);
- count++;
- }
- else if (parameters[index] is Byte)
- {
- PS3.Extension.WriteByte(0x10050000 + (count * 4), (Byte)parameters[index]);
- count++;
- } //Should work now :D let me try
- else
- {
- UInt32 pointer;
- if (parameters[index] is String)
- {
- pointer = 0x10052000 + (Strings * 0x400);
- PS3.Extension.WriteString(pointer, Convert.ToString(parameters[index]));
- PS3.Extension.WriteUInt32(0x10050000 + (count * 4), pointer);
- count++;
- Strings++;
- }
- else if (parameters[index] is Single)
- {
- WriteSingle(0x10050024 + (Single * 4), (Single)parameters[index]);
- Single++;
- }
- else if (parameters[index] is Single[])
- {
- Single[] Args = (Single[])parameters[index];
- pointer = 0x10051000 + Array * 4;
- WriteSingle(pointer, Args);
- PS3.Extension.WriteUInt32(0x10050000 + count * 4, pointer);
- count++;
- Array += (UInt32)Args.Length;
- }
- }
- index++;
- }
- PS3.Extension.WriteUInt32(0x10050048, address);
- Thread.Sleep(20);
- return PS3.Extension.ReadInt32(0x1005004c);
- }
- private static void WriteSingle(uint address, float input)
- {
- byte[] array = new byte[4];
- BitConverter.GetBytes(input).CopyTo(array, 0);
- Array.Reverse(array, 0, 4);
- PS3.SetMemory(address, array);
- }
- private static byte[] ReverseBytes(byte[] inArray)
- {
- Array.Reverse(inArray);
- return inArray;
- }
- private 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 DestroyAll()
- {
- Byte[] clear = new Byte[0xB4 * 1024];
- PS3.SetMemory(0xF0E10C, clear);
- }
- private static byte[] ReadBytes(uint address, int length)
- {
- return GetMemory(address, length);
- }
- public static Single[] ReadSingle(uint address, int length)
- {
- byte[] mem = ReadBytes(address, length * 4);
- Array.Reverse(mem);
- float[] numArray = new float[length];
- for (int index = 0; index < length; ++index)
- numArray[index] = BitConverter.ToSingle(mem, (length - 1 - index) * 4);
- return numArray;
- }
- #endregion
- #region PlayerFX
- public static uint PlayFX(float[] Origin, int EffectIndex)
- {
- uint ent = (uint)RPC.Call(0x1C0B7C, Origin, 0x56); //G_Temp
- PS3.Extension.WriteInt32(ent + 0xA0, EffectIndex);
- PS3.Extension.WriteInt32(ent + 0xD8, 0);
- PS3.Extension.WriteFloat(ent + 0x40, 0f);
- PS3.Extension.WriteFloat(ent + 0x44, 0f);
- PS3.Extension.WriteFloat(ent + 0x3C, 270f);
- return ent;
- }
- #endregion
- public float[] GetOrigin(uint client)
- {
- float[] Origin;
- Origin = ReadSingle(0x0110A29C + 0x3980 * client, 3);
- return Origin;
- }
- private float[] ReadSingle(uint address, int length)
- {
- byte[] memory = GetMemory(address, length * 4);
- ReverseBytes(memory);
- float[] numArray = new float[length];
- for (int i = 0; i < length; i++)
- {
- numArray[i] = BitConverter.ToSingle(memory, ((length - 1) - i) * 4);
- }
- return numArray;
- }
- //Use this to play the FX - Its a Single[]
- public static void SetFX(UInt32 Client,Int32 FX_Value)
- {
- Single[] Origin = GetOrigin(Client);
- Mw3Library.Multiplayer.RPC.PlayFX(Origin, FX_Value);
- }
- public static byte[] GetMemory(uint Offset, int Length)
- {
- byte[] buffer = new byte[Length];
- PS3.GetMemory(Offset, buffer);
- return buffer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement