#pragma warning restore CSE0003 public static FunctionLocalsInfo[] GetFunctionLocals(GMFileContent content, SectionRefDefs *section) { uint extraOffset = section->Entries.NameOffset * (uint)sizeof(RefDefEntry); IntPtr extraStart = (IntPtr)((byte *)§ion->Entries.Occurrences + extraOffset); uint count = *(uint *)extraStart; var r = new FunctionLocalsInfo[count]; uint i = 0; for (var entryPtr = (byte *)extraStart + 4; i < count; i++) { var extraEntry = (FunctionLocalsEntry *)entryPtr; var info = new FunctionLocalsInfo(); info.FunctionName = StringFromOffset(content, extraEntry->FunctionName); info.LocalNames = new string[extraEntry->LocalsCount]; entryPtr += 8; for (uint j = 0; j < extraEntry->LocalsCount; j++) { var local = (FunctionLocalEntry *)entryPtr; info.LocalNames[local->Index] = StringFromOffset(content, local->Name); entryPtr += sizeof(FunctionLocalEntry); } r[i] = info; } return(r); }
private static JsonData SerializeFuncLocalsInfo(FunctionLocalsInfo fli) { var r = CreateObj(); r["name"] = fli.FunctionName; r["locals"] = SerializeArray(fli.LocalNames, Utils.Identity); return(r); }