LAK132 / SourceExplorer

GNU General Public License v3.0
136 stars 13 forks source link

SystemOffset is not reading correctly #47

Open 1987kostya opened 3 years ago

1987kostya commented 3 years ago

Log is not important here

SE is trying to use part of the qualifiers as a SystemOffset, because you are only skipping 8 of them, but there is 9. image

There is a const size_t end = cstrm.position + 16; in common_t class, but you should use const size_t end = cstrm.position + 18; instead, so you can dump counter images, texts and other objects

LAK132 commented 3 years ago

Good catch! Do you know if this affects all versions of CTF/MMF?

1987kostya commented 3 years ago

In C#, i am reading qualifiers with

var end = Reader.Tell()+(8+1)*2;
List<Int16> qualifiers = new List<Int16>();
while(true)
{
    var value = Reader.ReadInt16();
    if(value!=-1) qualifiers.Add(value);
    else break;
}
Reader.Seek(end);

I am not very good at C++, but basically it works like If the value is not -1 - we are saving it, if its -1 - we break the loop and move to the next offset

If there is 1 qualifier - it would look like 10 FF FF FF FF FF FF FF FF, if there is 2 - 10 20 FF FF FF FF FF FF FF, if there is 8 - 10 20 30 40 50 60 70 80 FF So there is always FF at the end of this part of the memory

So i think it should affect all versions of CTF. I tested it with FNaF 1, FNaF 2, FNaF 3 and Sister Location and it worked everywhere.