Advertisement
BaSs_HaXoR

SPRX PS3LIB (C++)

Jul 20th, 2014
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.96 KB | None | 0 0
  1. void SetMemory(int Address, unsigned char* Input)
  2. {
  3.         int i = 0;
  4.         while(true)
  5.         {
  6.                 if (*(unsigned char*)(Input + i) == 0x00)
  7.                         break;
  8.                 *(int*)(Address + i) = *(unsigned char*)Input;
  9.         }
  10. }
  11.  
  12. void WriteString(int Address, const char* Input)
  13. {
  14.         int i = 0;
  15.         while(true)
  16.         {
  17.                 if(*(char*)(Input+i) == 0x00)
  18.                 {break;}
  19.  
  20.                 *(int*)(Address + i) = *(char*)(Input + i);
  21.                 i++;
  22.         }
  23. }
  24.  
  25. char* ReadString(int Address)
  26. {
  27.         return (char*)Address;
  28. }
  29.  
  30. void WriteInt32(int Address, int Input)
  31. {
  32.         *(int*)Address = Input;
  33. }
  34.  
  35. int ReadInt32(int Address)
  36. {
  37.         return *(int*)Address;
  38. }
  39.  
  40. void WriteFloat(int Address, float Input)
  41. {
  42.         *(float*)Address = Input;
  43. }
  44.  
  45. void WriteSingle(int Address, float Input, int Length)
  46. {
  47.         for (int i = 0; i < Length; i++)
  48.                 WriteFloat(Address + (i * 4), Input);
  49. }
  50.  
  51. float ReadFloat(int Address)
  52. {
  53.         return *(float*)Address;
  54. }
  55.  
  56. float* ReadSingle(int Address, int Length)
  57. {
  58.         float* Value;
  59.         for (int i = 0; i < Length; i ++)
  60.                 Value[i] = ReadFloat(Address + (i * 4));
  61.         return Value;
  62. }
  63.  
  64. void WriteByte(int Address, unsigned char Input)
  65. {
  66.         *(unsigned char*)Address = Input;
  67. }
  68.  
  69. unsigned char ReadByte(int Address)
  70. {
  71.         return *(unsigned char*)Address;
  72. }
  73.  
  74. unsigned char* ReadBytes(int Address, int Length)
  75. {
  76.         unsigned char* Value;
  77.         for (int i = 0; i < Length; i ++)
  78.                 Value[i] = ReadByte(Address + Length;
  79. }
  80.  
  81. void WriteBytes(int Address, unsigned char Input, int Length)
  82. {
  83.         for (int i = 0; i < Length; i ++)
  84.                 WriteByte(Address + i, Input);
  85. }
  86.  
  87. void WriteBool(int Address, bool Input)
  88. {
  89.         WriteByte(Address, (int)Input);
  90. }
  91.  
  92. bool ReadBool(int Address)
  93. {
  94.         return ReadByte(Address) != 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement