Skip to content

Commit

Permalink
Merge pull request #1748 from BenjaminUrquhart/master
Browse files Browse the repository at this point in the history
Fix 2024.2 detection (makes Undertale Yellow load again)
  • Loading branch information
colinator27 authored May 2, 2024
2 parents 3ccc168 + 921e0c8 commit 1fef615
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion UndertaleModLib/Models/UndertaleRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ public void ReadCompressedTileData(UndertaleReader reader)

// sanity check: run of 2 empty tiles
if (length != 0x81)
throw new IOException("Expected 0x81, got " + length.ToString("X2"));
throw new IOException("Expected 0x81, got 0x" + length.ToString("X2"));
if (tile != unchecked((uint)-1))
throw new IOException("Expected -1, got " + tile + " (0x" + tile.ToString("X8") + ")");
}
Expand Down
11 changes: 7 additions & 4 deletions UndertaleModLib/UndertaleChunks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -916,17 +916,20 @@ private void CheckForTileCompression(UndertaleReader reader)
if (layerType != LayerType.Tiles)
continue;

reader.Position += 10 * 4;
reader.Position += 32;
int effectCount = reader.ReadInt32();
reader.Position += effectCount * 12 + 4;

int tileMapWidth = reader.ReadInt32();
int tileMapHeight = reader.ReadInt32();
if (nextOffset - reader.AbsPosition != (tileMapWidth * tileMapHeight * 4))
{
// Check complete, found and tested a layer.
reader.undertaleData.SetGMS2Version(2024, 2);
reader.Position = returnTo;
checkedFor2024_2 = true;
return;
}
reader.Position = returnTo;
checkedFor2024_2 = true;
return;
}
}

Expand Down

0 comments on commit 1fef615

Please sign in to comment.