Advertisement
busmanl30

Sum stuff

Sep 6th, 2019
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.64 KB | None | 0 0
  1. I will add more to this as I go along.
  2. */
  3.  
  4. union intfloat {
  5.     int i;
  6.     float f;
  7. };
  8.  
  9. /*
  10. Get the real value of an ObscuredInt.
  11.  
  12. Parameters:
  13.     - location: the location of the ObscuredInt
  14. */
  15. int GetObscuredIntValue(uint64_t location){
  16.     int cryptoKey = *(int *)location;
  17.     int obfuscatedValue = *(int *)(location + 0x4);
  18.    
  19.     return obfuscatedValue ^ cryptoKey;
  20. }
  21.  
  22. /*
  23. Set the real value of an ObscuredInt.
  24.  
  25. Parameters:
  26.     - location: the location of the ObscuredInt
  27.     - value: the value we're setting the ObscuredInt to
  28. */
  29. void SetObscuredIntValue(uint64_t location, int value){
  30.     int cryptoKey = *(int *)location;
  31.    
  32.     *(int *)(location + 0x4) = value ^ cryptoKey;
  33. }
  34.  
  35. /*
  36. Get the real value of an ObscuredFloat.
  37.  
  38. Parameters:
  39.     - location: the location of the ObscuredFloat
  40. */
  41. float GetObscuredFloatValue(uint64_t location){
  42.     int cryptoKey = *(int *)location;
  43.     int obfuscatedValue = *(int *)(location + 0x4);
  44.    
  45.     /* use this intfloat to set the integer representation of our parameter value, which will also set the float value */
  46.     intfloat IF;
  47.     IF.i = obfuscatedValue ^ cryptoKey;
  48.    
  49.     return IF.f;
  50. }
  51.  
  52. /*
  53. Set the real value of an ObscuredFloat.
  54.  
  55. Parameters:
  56.     - location: the location of the ObscuredFloat
  57.     - value: the value we're setting the ObscuredFloat to
  58. */
  59. void SetObscuredFloatValue(uint64_t location, float value){
  60.     int cryptoKey = *(int *)location;
  61.  
  62.     /* use this intfloat to get the integer representation of our parameter value */
  63.     intfloat IF;
  64.     IF.f = value;
  65.    
  66.     /* use this intfloat to generate our hacked ObscuredFloat */
  67.     intfloat IF2;
  68.     IF2.i = IF.i ^ cryptoKey;
  69.    
  70.     *(float *)(location + 0x4) = IF2.f;
  71. }
  72.  
  73. /*
  74. Get the real value of an ObscuredVector3.
  75.  
  76. Parameters:
  77.     - location: the location of the ObscuredVector3
  78. */
  79. Vector3 GetObscuredVector3Value(uint64_t location){
  80.     int cryptoKey = *(int *)location;
  81.  
  82.     Vector3 ret;
  83.  
  84.     intfloat IF;
  85.  
  86.     IF.i = *(int *)(location + 0x4) ^ cryptoKey;
  87.  
  88.     ret.x = IF.f;
  89.  
  90.     IF.i = *(int *)(location + 0x8) ^ cryptoKey;
  91.  
  92.     ret.y = IF.f;
  93.  
  94.     IF.i = *(int *)(location + 0xc) ^ cryptoKey;
  95.  
  96.     ret.z = IF.f;
  97.  
  98.     return ret;
  99. }
  100.  
  101. /*
  102. Set the real value of an ObscuredVector3.
  103.  
  104. Parameters:
  105.     - location: the location of the ObscuredVector3
  106.     - value: the value we're setting the ObscuredVector3 to
  107. */
  108. void SetObscuredVector3Value(uint64_t location, Vector3 value){
  109.     int cryptoKey = *(int *)location;
  110.    
  111.     intfloat IF;
  112.     IF.f = value.x;
  113.  
  114.     intfloat IF2;
  115.     IF2.i = IF.i ^ cryptoKey;
  116.  
  117.     *(float *)(location + 0x4) = IF2.f;
  118.  
  119.     IF.f = value.y;
  120.     IF2.i = IF.i ^ cryptoKey;
  121.  
  122.     *(float *)(location + 0x8) = IF2.f;
  123.  
  124.     IF.f = value.z;
  125.     IF2.i = IF.i ^ cryptoKey;
  126.  
  127.     *(float *)(location + 0xc) = IF2.f;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement