Skip to content

Commit

Permalink
Autofix datawins affected by the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CST1229 committed Mar 21, 2024
1 parent d8161b0 commit 77531b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions UndertaleModLib/Models/UndertaleCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,12 @@ public void Unserialize(UndertaleReader reader)
byte TypePair = reader.ReadByte();
Type1 = (DataType)(TypePair & 0xf);
Type2 = (DataType)(TypePair >> 4);

// Fix data.wins affected by a bug in UTMTCE 0.4.0 where self calls
// triggered the below error
if (Kind == Opcode.CallV && Type2 != (byte)0) {
Type2 = (byte)0;
}
#if DEBUG
if (GetInstructionType(Kind) == InstructionType.SingleTypeInstruction && Type2 != (byte)0)
throw new IOException("Second type should be 0 in " + Kind.ToString().ToUpper(CultureInfo.InvariantCulture));
Expand Down

0 comments on commit 77531b3

Please sign in to comment.