My come back.
In the last video, we took a deep dive into the smiley code and figured out how these if statements
work.
Now we will recap this knowledge and also move on regarding to other instructions.
And we directly start with our huge table over here.
There we go.
Okay, this one looks a little bit complicated.
Let's discuss this.
So what do we have here?
We have our comparison, our if statement, and we got on the left, the syntax and on the right, the
description.
And in the middle, this is how you save this out loud.
And if you do this, you will recognize or even know what this if statement does.
For example, if you take a look at the last line, if less equals, zero means we are comparing the
X against the value zero and we check if it's less than equal.
To be honest, the last four I also look up sometimes because I'm not sure if the zero is now included
or not.
Therefore, let's go to the first two.
There we have, if equal, zero.
So if the x is equal zero, not equal zero, less than zero, and so on.
It looks super damp, but say this out loud if you are watching this, or maybe if you're alone in a
room and yeah, keep practicing.
So this will helps you a lot in recognizing what this if statement does.
Okay.
If you are only having one register.
If we x register, we are comparing against zero sometimes, including sometimes not.
All right.
Okay.
And afterwards, there's this target this year label where we jump to this is the true statement.
Otherwise, if our statement is false, we move on in the code, but we will have a look into this also.
Okay, here we have the instruction and say it out loud.
Then you realize or recognize what the does and we have to read it in the following way.
If we zero is greater equals zero, then we jump to condition zero.
Yeah, I know it looks dumb, but if you keep doing this, it's these.
If statements will be no problem for you.
Okay.
And this is what we forget or what we get.
Yeah.
If we zero greater equals zero, then jump to condition zero.
All right, this is our, let's say, schema on this.
We've gotten if statement, then we've got the comparison.
We've got our register and we've got the two jump conditions.
One is our condition, which is directly after this if statement if the statement is true and then we
also get those go tos and regarding to the go tos, please try to recognize this that we've gotten go
to in front of this and afterwards the label if we are encountering only our colon and then this label,
we can simply ignore or skip this function.
If you do some smiley patching afterwards or later in this course, you will get through this or come
over this, go to label a lot.
And yeah, in my case I struggled a little bit after I just memorized, okay, we need to have an go
to in front of this.
Otherwise it's just in jump instruction where we end here and we can ignore this.
All righty.
Next we've got two registers.
So it's the tempo is increasing.
You see this already, but this is absolutely the same as before.
Instead of zero, we are having now two registers.
So I marked this in this way and we also keep the same in the same way.
So in this case we are comparison or in the first line we are comparing.
If we x is equal to v y in the next one we check if the these are not equal, less then greater, equal
and so on.
So if we are having two registers, we are comparing against another register not equal to zero.
Okay, the register can have the value zero, but nevertheless it would be compared against this register.
Okay, let's see how we would say this out loud.
So let's go.
We've got if then we've got the zero and now we get back to the condition once again, exactly the same.
So I guess I should stop talking during this.
Now let's do it once again.
If V zero is greater than v one, we jump to this condition.
So if we are having two registers, we do it in this way.
And this will gives us the following statement and this is correct.
So if b zero is greater than V one, we come to this condition.
Otherwise we go on and or we move on in our code and yeah, maybe doesn't go to label or maybe the function
is returning in there.
We do not have or it's not required to have an go to label.
This is also important to keep in mind.
All right.
There we go.
Exactly the same.
If this time we do not have the value zero, therefore we only have an equal, not equal, less or greater
and our registers and the conditions where we jump to.
So yeah, these are exactly the same beside the fact that we are having another register and not comparing
against the value zero.
All right.
Last time it was a little bit messy.
Let's see if this approach is easier for you to handle.
So let's see.
We've got our method method collision.
It's returning void.
And on the left side we've got the Java code, so we've got the local register.
We do not know if it's in variable or on placeholder for on value in the first line we can see sorry
in the line 38, we can see we are getting or yeah, we are fetching this object, this dot lives and
putting it into v zero.
Then we make our comparison.
So say this out loud.
If the zero is greater equals zero, we jump to condition zero.
Condition zero is over here.
So we skip this part, this code underneath until we get to this condition.
Then we are adding and minus one, which means we are subtracting and value.
So pretty ridiculous but never mind.
And then we are putting this value back again into our lives.
So we are subtracting one from our lives.
Okay, this is our true statement.
In case it's a false statement, we are moving on until we hit this go to label and then we move on
to the go to label.
By the way, at the first time I forgot to mention that we skipped this go to in line 56, but you should
be familiar with this.
All right.
Okay.
And let's do the comparison regarding to the code on the left.
Interesting.
Our if statement is different, we are comparing if this lives is less than zero.
But on the right and our smiley code, we have one condition, vice versa.
We talked about this in the video and again, we have it the same way right now.
Then we can see our V0 is going to be initialized with one and this one is going to be put or referenced
with the variable name blues.
So we are putting one into our LUS, which is from type boolean.
This means lose is equal true at this line over here.
This is our blue part.
All right.
And these are our two cases.
The first one, if our if statement above is true, be subtracting one life from our player lives and
we return out.
We skip this, go to and return out.
And if our statement in line 40 is false, then we move on and we set our variable name loose to the
value.
True.
And yeah, that's it.
Afterwards we go to this label and return out of this function.
All right.
If we do this on the smiley part, we can see this over here.
This is what it looks like.
And we can see once again, the smiley part is different regarding to the Java part.
And it's also what's Android telling us or reminding us.
Therefore, do not stick to the Java code regarding to if statements.
Have a look at this.
But this might be different in the smiley part.
And the smiley part is the one that matters because this is the one that's getting executed and the
one we can patch.
Therefore, try to understand the if statement first and then try to apply your patch.
And do not try guessing with line numbers or things like this.
I tried this and it didn't go that well.
So you will lose a lot of time and you get a little bit frustrating.
Therefore, I try to do a clean, reverse engineering approach on the if statement you want to patch.
Then you are good to go and you will lose less time.
All right.
Okay.
Next, we want to keep practicing because this is the most important part if you want to learn smartly.
Therefore, I extend our code and our Java and I will provide this afterwards to you.
We do not look up the source code of the Java part because this might be even more confusing regarding
to if statements.
We do our approach once again on the smiley part, and by doing this we will also recap all the stuff.
We will introduce maybe new statements we haven't seen right now, at least in the table and things
like this.
So we keep practicing.
And yeah, by doing this over and over again, you will become a smiley master.
After this chapter, believe me, you will be able to read and write fancy, nice smiley code.
Okay.
The practicing part will be in the next video and this was some kind of spoiler for this.
Therefore, I'm looking forward to see you there.