• Hello
Search Results for

    Show / Hide Table of Contents

    Struct ProtectedFloat

    Drop-in replacement for System.Single that obfuscates the value in memory (via a GUPS.AntiCheat.Protected.UIntFloat reinterpret cast) and reports tampering to the .

    Implements
    IProtected
    IDisposable
    ISerializationCallbackReceiver
    Namespace: GUPS.AntiCheat.Protected
    Assembly: cs.temp.dll.dll
    Syntax
    public struct ProtectedFloat

    Constructors

    ProtectedFloat(Single)

    Initializes a new protected float with the specified value.

    Declaration
    public ProtectedFloat(float value = 0F)
    Parameters
    Type Name Description
    System.Single value

    Initial value.

    Properties

    HasIntegrity

    Gets a value indicating whether the protected value still has integrity (i.e. the honeypot has not been tampered with).

    Declaration
    public bool HasIntegrity { get; }
    Property Value
    Type Description
    System.Boolean

    Value

    Gets or sets the unobfuscated value.

    Declaration
    public float Value { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    Reading the value runs an integrity check; if the honeypot has been tampered with, the is notified.

    Methods

    CheckIntegrity()

    Returns true when the honeypot still matches the obfuscated value.

    Declaration
    public bool CheckIntegrity()
    Returns
    Type Description
    System.Boolean

    true if the value is intact; otherwise false.

    Dispose()

    Clears the obfuscated value, scratch union and secret.

    Declaration
    public void Dispose()

    Equals(Object)

    Returns true when this protected value equals the given object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Object to compare with.

    Returns
    Type Description
    System.Boolean

    true if equal; otherwise false.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns the hash code of the obfuscated bit pattern.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    Hash code based on the stored obfuscated bits (does not unobfuscate).

    Overrides
    System.ValueType.GetHashCode()

    Obfuscate()

    Rerolls the secret and re-obfuscates the current value.

    Declaration
    public void Obfuscate()

    OnAfterDeserialize()

    Unity deserialization hook; rebuilds the obfuscation state from the deserialized honeypot value.

    Declaration
    public void OnAfterDeserialize()

    OnBeforeSerialize()

    Unity serialization hook; writes the true value into the honeypot field.

    Declaration
    public void OnBeforeSerialize()

    ToString()

    Returns the string representation of the unobfuscated value.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    The string representation of the unobfuscated value.

    Overrides
    System.ValueType.ToString()

    Operators

    Addition(ProtectedFloat, ProtectedFloat)

    Adds two protected values.

    Declaration
    public static ProtectedFloat operator +(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    ProtectedFloat

    The sum.

    Division(ProtectedFloat, ProtectedFloat)

    Divides the first protected value by the second.

    Declaration
    public static ProtectedFloat operator /(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    ProtectedFloat

    The quotient.

    Equality(ProtectedFloat, ProtectedFloat)

    Returns true when both protected values represent the same number.

    Declaration
    public static bool operator ==(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if equal; otherwise false.

    Remarks

    Uses direct System.Single equality and is therefore subject to the usual floating-point precision caveats.

    GreaterThan(ProtectedFloat, ProtectedFloat)

    Returns true when the first value is greater than the second.

    Declaration
    public static bool operator>(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if v1 > v2; otherwise false.

    GreaterThanOrEqual(ProtectedFloat, ProtectedFloat)

    Returns true when the first value is greater than or equal to the second.

    Declaration
    public static bool operator >=(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if v1 >= v2; otherwise false.

    Implicit(ProtectedFloat to ProtectedInt16)

    Implicitly converts a protected float to a ProtectedInt16 (truncates).

    Declaration
    public static implicit operator ProtectedInt16(ProtectedFloat _Value)
    Parameters
    Type Name Description
    ProtectedFloat _Value

    Protected float to convert.

    Returns
    Type Description
    ProtectedInt16

    A protected Int16 holding the truncated value.

    Implicit(ProtectedFloat to ProtectedInt32)

    Implicitly converts a protected float to a ProtectedInt32 (truncates).

    Declaration
    public static implicit operator ProtectedInt32(ProtectedFloat _Value)
    Parameters
    Type Name Description
    ProtectedFloat _Value

    Protected float to convert.

    Returns
    Type Description
    ProtectedInt32

    A protected Int32 holding the truncated value.

    Implicit(ProtectedFloat to ProtectedInt64)

    Implicitly converts a protected float to a ProtectedInt64 (truncates).

    Declaration
    public static implicit operator ProtectedInt64(ProtectedFloat _Value)
    Parameters
    Type Name Description
    ProtectedFloat _Value

    Protected float to convert.

    Returns
    Type Description
    ProtectedInt64

    A protected Int64 holding the truncated value.

    Implicit(ProtectedFloat to Single)

    Implicitly unwraps a protected float to its float value.

    Declaration
    public static implicit operator float (ProtectedFloat _Value)
    Parameters
    Type Name Description
    ProtectedFloat _Value

    Protected float to unwrap.

    Returns
    Type Description
    System.Single

    The unobfuscated float value.

    Implicit(ProtectedInt16 to ProtectedFloat)

    Implicitly converts a ProtectedInt16 to a protected float.

    Declaration
    public static implicit operator ProtectedFloat(ProtectedInt16 _Value)
    Parameters
    Type Name Description
    ProtectedInt16 _Value

    Protected Int16 to convert.

    Returns
    Type Description
    ProtectedFloat

    A protected float holding the converted value.

    Implicit(ProtectedInt32 to ProtectedFloat)

    Implicitly converts a ProtectedInt32 to a protected float.

    Declaration
    public static implicit operator ProtectedFloat(ProtectedInt32 _Value)
    Parameters
    Type Name Description
    ProtectedInt32 _Value

    Protected Int32 to convert.

    Returns
    Type Description
    ProtectedFloat

    A protected float holding the converted value.

    Implicit(ProtectedInt64 to ProtectedFloat)

    Implicitly converts a ProtectedInt64 to a protected float.

    Declaration
    public static implicit operator ProtectedFloat(ProtectedInt64 _Value)
    Parameters
    Type Name Description
    ProtectedInt64 _Value

    Protected Int64 to convert.

    Returns
    Type Description
    ProtectedFloat

    A protected float holding the converted value.

    Implicit(Single to ProtectedFloat)

    Implicitly wraps a float in a protected float.

    Declaration
    public static implicit operator ProtectedFloat(float _Value)
    Parameters
    Type Name Description
    System.Single _Value

    Value to wrap.

    Returns
    Type Description
    ProtectedFloat

    A protected float holding the given value.

    Inequality(ProtectedFloat, ProtectedFloat)

    Returns true when the two protected values represent different numbers.

    Declaration
    public static bool operator !=(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if not equal; otherwise false.

    LessThan(ProtectedFloat, ProtectedFloat)

    Returns true when the first value is less than the second.

    Declaration
    public static bool operator <(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if v1 < v2; otherwise false.

    LessThanOrEqual(ProtectedFloat, ProtectedFloat)

    Returns true when the first value is less than or equal to the second.

    Declaration
    public static bool operator <=(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    System.Boolean

    true if v1 <= v2; otherwise false.

    Multiply(ProtectedFloat, ProtectedFloat)

    Multiplies two protected values.

    Declaration
    public static ProtectedFloat operator *(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    ProtectedFloat

    The product.

    Subtraction(ProtectedFloat, ProtectedFloat)

    Subtracts the second protected value from the first.

    Declaration
    public static ProtectedFloat operator -(ProtectedFloat v1, ProtectedFloat v2)
    Parameters
    Type Name Description
    ProtectedFloat v1

    First operand.

    ProtectedFloat v2

    Second operand.

    Returns
    Type Description
    ProtectedFloat

    The difference.

    Implements

    IProtected
    IDisposable
    ISerializationCallbackReceiver

    See Also

    ProtectedInt32
    In This Article
    Back to top GuardingPearSoftware documentation