the "MR" in Dolphin is a shorthand!
Ghidra picks it up as what it actually does
I guess its similar to `nop` in other languages lmao
Which translates to `mov r0,r0`
Blegh, the PowerPC decomp is awful. It’s not finding any of the parameters
How did you reverse engineer the KXX files in the first place?
Well, it's been 4-5 years since I started reverse engineering so I don't know remember exactly, but I probably reverse engineered it by mainly looking at the files with a hex editor, and only look at the disassembly when I feel like I need or wouldn't manage to continue progress otherwise.
If you look at a KXX file you might notice that some 32-bit values are actually offsets in this file. And often, if for example you see an offset, and go there with a hex editor, you will see at that offset you have another value containing an offset in the file.
In fact a lot of parts of the file are prefixed with a "skip offset". The game generally doesn't use them when it reads the data, but if the game needs to skip that part, it will use that skip offset to jump to the offset and go the next part without having to read the data.
And after more research I notice that there is basically a "tree" of data chunks (that is a chunk can contains chunks, and "skip offset" would skip to the next chunk of the same level)
At the same time, in the executable, you can find strings of names of all classes in the game (such as CKLevel, CKHkSomething, CTextureDictionary, ...)
and if you search for references to the class name, you will find code like this:
Such code exists for every class and is executed at the start of the game, which "registers" the class
so something I did was hooking that class registering function (sub_4DB940 in the screenshot) to get a list of all classes along with the arguments
The most interesting ones are the first two ones, which look like IDs for the classes, in this case CKLevel has an ID of (12, 5)
```8 22 CKDisplayPictureCinematicBloc
8 23 CKManageCameraCinematicBloc
8 25 CKStartEventCinematicBloc
8 26 CKSkyCinematicBloc
8 27 CKLightningCinematicBloc
8 28 CKPlaySoundCinematicBloc
9 1 CAnimationDictionary
9 2 CTextureDictionary
9 3 CKSoundDictionary
9 4 CKSoundDictionaryID
10 1 CParticleGeometry
10 2 CGeometry
10 3 CSkinGeometry
11 1 CSGRootNode
11 2 CSGSectorRoot
11 3 CNode
11 5 CSGMovable```
If you look at the list you can see that the first number is for a "category of classes": for example 8 are cinematic blocs, 9 are dictionaries, 10 are geometries and 11 are scene nodes.
There are a total of 15 categories of these classes.