Skip to content

Commit a2a2f3d

Browse files
committed
Format pass on nothing.typ
1 parent 899109d commit a2a2f3d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/decomp-guide/nothing.typ

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In C++ a function that does nothing could look like this:
1919
{
2020
return;
2121
}
22-
```
22+
```,
2323
)
2424

2525
Note that we can choose whether or not to write the `return;` keyword.
@@ -32,16 +32,16 @@ It doesn't make a difference whether we write it out or not.
3232
so both of these functions
3333
are compiled down to a single `blr` assembly instruction:
3434
],
35-
image("nothing/nothing.png")
35+
image("nothing/nothing.png"),
3636
)
3737

3838
What does the assembly instruction `blr` mean?
3939

4040
#v(0.5cm)
41-
/ blr: "Branch to Link Register". Jumps to lr. Used to end a subroutine.
41+
/ blr: "Branch to Link Register". Jumps to lr. Used to end a subroutine.
4242
#v(0.5cm)
4343

44-
What is a Link Register?
44+
=== What is a Link Register?
4545

4646
_A link register (LR for short) is a register which holds the address to return to when a subroutine call completes. This is more efficient than the more traditional scheme of storing return addresses on a call stack, sometimes called a machine stack. The link register does not require the writes and reads of the memory containing the stack which can save a considerable percentage of execution time with repeated calls of small subroutines.
4747
The IBM POWER architecture, and its PowerPC and Power ISA successors, have a special-purpose link register, into which subroutine call instructions put the return address._
@@ -65,7 +65,7 @@ $0.07%$ of the entire game's code does nothing!
6565
Since we have a general idea of what an empty function is like,
6666
let's now decompile an empty function in BFBB.
6767

68-
==== Our First Function -- NPCWidget::Reset()
68+
=== Our First Function -- NPCWidget::Reset()
6969
We are going to look at the function `NPCWidget::Reset()`.
7070
It is a size 4 function located in the file
7171
`/Game/zNPCSupport.cpp`.
@@ -77,7 +77,7 @@ we can see the original assembly on the left, and nothing on the right.
7777

7878
We can see that the original assembly on the left just has one instruction,
7979
a `blr` instruction like we expect.
80-
When the right side says "Missing", this means that
80+
When the right side says "Missing", this means that
8181
we have yet to define the function in our game source file.
8282
This is to be expected at this point because we haven't decompiled this function yet.
8383

@@ -150,7 +150,7 @@ After we do this, Objdiff thanks us for our effort by greeting us with a new err
150150

151151
Again, the error message is pretty clear.
152152
We need to define `en_NPC_UI_WIDGETS`.
153-
Once again, we can't find this enum defined anywhere in
153+
Once again, we can't find this enum defined anywhere in
154154
our source header files yet, so it means that it hasn't
155155
been copied over yet.
156156
Let's do that now.
@@ -166,7 +166,7 @@ enum en_NPC_UI_WIDGETS {
166166
```
167167

168168
Once again, we want to copy this type over into our `zNPCSupport.h` file.
169-
We have to make sure that we put this definition before the definition of
169+
We have to make sure that we put this definition before the definition of
170170
`NPCWidget`, as that class references the enum.
171171

172172
Back in Objdiff, unsurprisingly, we have another error:
@@ -242,11 +242,11 @@ so solving the type errors would be as simple as including the appropriate heade
242242
#include "xVec3.h"
243243
#include "zFX.h"
244244
```
245-
If we didn't already have those types defined in those header files,
246-
you would have to copy the types for these parameters from
247-
the PS2 DWARF again.
248-
This is needed to get the file to compile
249-
despite the fact that the function itself does nothing.
245+
If we didn't already have those types defined in those header files,
246+
you would have to copy the types for these parameters from
247+
the PS2 DWARF again.
248+
This is needed to get the file to compile
249+
despite the fact that the function itself does nothing.
250250

251251
Then of course there are functions like `NPCWidget_Shutdown`
252252
which are not part of a class nor accept any parameters,
@@ -293,4 +293,4 @@ Whew. This was a longer chapter than anticipated,
293293
but we have learned quite a lot.
294294
Whenever you're ready let's head on to the next example
295295
and start decompiling functions that have
296-
some actual code in them.
296+
some actual code in them.

0 commit comments

Comments
 (0)