14 Attachment(s)
[IDA Pro] Add C structures for HexRays decompiler
A) View -> Open subviews -> Structures
Attachment 1075
B) Gonna see this window:
Attachment 1076
C) Edit -> Add struct type
Attachment 1077
D) Just enter a name, e.g. msg_t
Attachment 1078
E) Now we have this empty structure, we can't work further on it in "Local Types" window, so we need to add at least one element to it.
Add one element by clicking once on msg_t and press d multiple times (it will circle 1, 2, 4 bytes iirc, just let it on 4 bytes e.g.)
Attachment 1079
If you don't add an element, the "Local Types" window will show this (or I fucked up my IDA on some previous attempts...):
Attachment 1080
F) Should look like this now:
Attachment 1081
G) Now go to "Local Types" window
Attachment 1082
H) Right-click on msg_t and click "Edit..."
Attachment 1083
I) It will look like this first:
Attachment 1084
J) Just enter the structure as in Quake3 or RTCW/ET:
Attachment 1085
K) Now it will look like this:
Attachment 1086
L) Decompile some function using msg_t, e.g. MSG_WriteByte:
Attachment 1087
Click once on a1, press y, and change the type to msg_t *msg.
M) Tada, we have some nicely decompiled function, way easier to read:
Attachment 1088