# Questionneed help to understand the math behind a code

#### Trigun

Full Member
Game Name
Shop Titans
Anticheat
no
How long you been coding/hacking?
months
Coding Language
mostly ahk
hello,
i'm trying to find the conditions to fulfill a IF i found
i opened the dll with ILSpy and found this code:
C++:
``````a_2 = Fixed.o(a_2, g8().aj().ag0(global::g9.b.Type.CraftQuality, Fixed.ONE));
if (!Fixed.i(a_2, f.ahi()))``````
(if you want open the file is in line 481 dc.a1() )
basically i know the a_2 start value but don't understand what fixed.o do
i found that Fixed is a number converted from a string for ex the number 3.01 will be converted in this way
(3 << 16) + (1<<16 / 10^(2)length of "01")
the g8().aj().ag0(global::g9.b.Type.CraftQuality, Fixed.ONE) return a Fixed from 0.75 or 0.0005 string (with the formula)

fixed.o do this:
C++:
``````  public static Fixed o(Fixed A_0, Fixed A_1)  {
num4 = A_0.value >> 16;
num5 = A_1.value >> 16;
num7 = (A_0.value & 0xFFFF);
num6 = (A_1.value & 0xFFFF);
num3 = num4 * num5;
num3 <<= 16;
num3 += num4 * num6;
num3 += num7 * num5;
num3 += num7 * num6 >> 16;
return c(num3);``````
c(num3) should be just a check for launch exception out of range if needed

if i understood correctly it get the int from the Fixed and multiply and add to the num3 4 times? since a_1 is 0.xxx is always a number *0 ?

even if don't understand the number from f.ahi() i know that fixed.i is a a_2 <= f.ahi() so if i get a possible max value by scanning the a_2 possible results and hardcode a possible number i can bypass that with a few of try (increase the number till i found a matching value )

what i'm missing?

#### Attachments

• 2.5 MB Views: 0

#### Trigun

Full Member
this is how a fixed value is created from a string

C++:
``````array = A_0.Split('.');
int num3 = Convert.ToInt32(array);
@fixed = o(@fixed, Math.Abs(num3));
Fixed a_ = c(Convert.ToInt32(array));
a_ = n(a_, c((int)Math.Pow(10.0, array.Length)));
@fixed = q(@fixed, a_);

function o(Fixed A_0, int A_1) {
return c(A_0.value + ((long)A_1 << 16));
}
function c(long A_0) {
Fixed result = default(Fixed);
result.value = (long)A_0 << 16;
return result;
}
function n(Fixed A_0, Fixed A_1)  {
return c((A_0.value << 16) / A_1.value);
}
function q(Fixed A_0, Fixed A_1)  {
return c(A_0.value + A_1.value);
}``````

Last edited:
Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language 