Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I will add more to this as I go along.
- */
- union intfloat {
- int i;
- float f;
- };
- /*
- Get the real value of an ObscuredInt.
- Parameters:
- - location: the location of the ObscuredInt
- */
- int GetObscuredIntValue(uint64_t location){
- int cryptoKey = *(int *)location;
- int obfuscatedValue = *(int *)(location + 0x4);
- return obfuscatedValue ^ cryptoKey;
- }
- /*
- Set the real value of an ObscuredInt.
- Parameters:
- - location: the location of the ObscuredInt
- - value: the value we're setting the ObscuredInt to
- */
- void SetObscuredIntValue(uint64_t location, int value){
- int cryptoKey = *(int *)location;
- *(int *)(location + 0x4) = value ^ cryptoKey;
- }
- /*
- Get the real value of an ObscuredFloat.
- Parameters:
- - location: the location of the ObscuredFloat
- */
- float GetObscuredFloatValue(uint64_t location){
- int cryptoKey = *(int *)location;
- int obfuscatedValue = *(int *)(location + 0x4);
- /* use this intfloat to set the integer representation of our parameter value, which will also set the float value */
- intfloat IF;
- IF.i = obfuscatedValue ^ cryptoKey;
- return IF.f;
- }
- /*
- Set the real value of an ObscuredFloat.
- Parameters:
- - location: the location of the ObscuredFloat
- - value: the value we're setting the ObscuredFloat to
- */
- void SetObscuredFloatValue(uint64_t location, float value){
- int cryptoKey = *(int *)location;
- /* use this intfloat to get the integer representation of our parameter value */
- intfloat IF;
- IF.f = value;
- /* use this intfloat to generate our hacked ObscuredFloat */
- intfloat IF2;
- IF2.i = IF.i ^ cryptoKey;
- *(float *)(location + 0x4) = IF2.f;
- }
- /*
- Get the real value of an ObscuredVector3.
- Parameters:
- - location: the location of the ObscuredVector3
- */
- Vector3 GetObscuredVector3Value(uint64_t location){
- int cryptoKey = *(int *)location;
- Vector3 ret;
- intfloat IF;
- IF.i = *(int *)(location + 0x4) ^ cryptoKey;
- ret.x = IF.f;
- IF.i = *(int *)(location + 0x8) ^ cryptoKey;
- ret.y = IF.f;
- IF.i = *(int *)(location + 0xc) ^ cryptoKey;
- ret.z = IF.f;
- return ret;
- }
- /*
- Set the real value of an ObscuredVector3.
- Parameters:
- - location: the location of the ObscuredVector3
- - value: the value we're setting the ObscuredVector3 to
- */
- void SetObscuredVector3Value(uint64_t location, Vector3 value){
- int cryptoKey = *(int *)location;
- intfloat IF;
- IF.f = value.x;
- intfloat IF2;
- IF2.i = IF.i ^ cryptoKey;
- *(float *)(location + 0x4) = IF2.f;
- IF.f = value.y;
- IF2.i = IF.i ^ cryptoKey;
- *(float *)(location + 0x8) = IF2.f;
- IF.f = value.z;
- IF2.i = IF.i ^ cryptoKey;
- *(float *)(location + 0xc) = IF2.f;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement