Commit ce4c794f authored by Spencer Alves's avatar Spencer Alves

Variable type test and remove debug output

parent 40f14d73
......@@ -487,7 +487,8 @@ namespace Altar.Repack
{
Name = setinst.TargetVariable,
InstanceType = setinst.InstanceType,
Instance = setinst.InstanceType == InstanceType.Local ? name : null
Instance = setinst.InstanceType == InstanceType.Local ? name : null,
VariableType = setinst.VariableType
}, size));
break;
case InstructionKind.Push:
......@@ -505,7 +506,8 @@ namespace Altar.Repack
{
Name = p.VariableName,
InstanceType = p.InstanceType,
Instance = p.InstanceType == InstanceType.Local ? name : null
Instance = p.InstanceType == InstanceType.Local ? name : null,
VariableType = p.VariableType
}, size));
}
else
......@@ -546,7 +548,8 @@ namespace Altar.Repack
functionReferences.Add(new Tuple<ReferenceSignature, uint>(new ReferenceSignature
{
Name = callinst.FunctionName,
InstanceType = InstanceType.StackTopOrGlobal
InstanceType = InstanceType.StackTopOrGlobal,
VariableType = callinst.FunctionType
}, size));
break;
case InstructionKind.Break:
......
......@@ -1118,12 +1118,14 @@ namespace Altar.Repack
variableReferences.Add(new Tuple<ReferenceSignature, uint>(new ReferenceSignature
{
Name = "prototype",
InstanceType = InstanceType.Self
InstanceType = InstanceType.Self,
VariableType = VariableType.Normal
}, 0xFFFFFFFF));
variableReferences.Add(new Tuple<ReferenceSignature, uint>(new ReferenceSignature
{
Name = "@@array@@",
InstanceType = InstanceType.Self
InstanceType = InstanceType.Self,
VariableType = VariableType.Normal
}, 0xFFFFFFFF));
int[] bytecodeOffsets = null;
......@@ -1205,10 +1207,7 @@ namespace Altar.Repack
Functions = functionStartOffsetsAndCounts.ToArray(),
Variables = variableStartOffsetsAndCounts.ToArray()
};
var j = Unpack.Serialize.SerializeVars(f);
System.IO.File.WriteAllText(@"F:\Users\Spencer\Downloads\JetBoy LD41\data\variables2.json", j.ToJson());
data.OffsetOffsets = allOffs.ToArray();
return stringOffsetOffsets;
......@@ -1281,13 +1280,15 @@ namespace Altar.Repack
InstanceType = targetRef.InstanceType,
Name = targetRef.Name,
Occurrences = count,
unknown2 = targetRef.InstanceType == InstanceType.Local ? localCount : nonLocalCount
unknown2 = targetRef.InstanceType == InstanceType.Local ?
localCount : targetRef.VariableType == VariableType.StackTop ?
nonLocalCount : - 6
});
if (targetRef.InstanceType == InstanceType.Local)
{
localCount++;
}
else
else if (targetRef.VariableType == VariableType.StackTop)
{
nonLocalCount++;
}
......
......@@ -23,12 +23,7 @@ namespace Altar
public string Name;
public InstanceType InstanceType;
public string Instance;
public ReferenceSignature(ReferenceDef r)
{
Name = r.Name;
InstanceType = r.InstanceType;
Instance = null;
}
public VariableType VariableType;
public override string ToString() => Name;
}
// ---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment