In Pascal there is the Set object, that you set (n<256) bits and then can later check if bit n is set or not. Sort of like a bool array.
When you decompile a DOS Pascal program the IDA-Pro Flirt signatures will find the Set functions, in this example we will focus Set::MemberOf
arg_0 is the Set object and
arg_4 is the byte we are checking to see if it’s set. When this code is called it looks like this:
byte_152FE location is an unknown mess like so:
as we know this data is a Set object, it would be nice if it was represented as such. Now we could
Declare this a structure variable (Alt-Q) by hand and then rename it.
This works for a few small cases, but in the Gold Box games,
Sets are used to manage lots of things so there are too many of them. The best trick here is to get IDA-Pro to do the work for us.
First you will need to have created a
Set structure (needed for the above manual process) that is 0x20 bytes long.
Now go back to
Associate a prototype to a function (Y) and change the prototype from:
int __stdcall far Set__MemberOf(__int32 _set);
int __stdcall far Set__MemberOf(Set set, char);
and ta-da the code call
Set::MemberOf is tidy:
and all the Set data blocks are typed for us also: