Skip to content

Commit

Permalink
Fix PS4 TR11 bigfile not opening
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Dec 3, 2023
1 parent 631374c commit 402ace4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Yura/Archive/TigerArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ namespace Yura.Archive
class TigerArchive : ArchiveFile
{
private string _file;
private TextureFormat _platform;
private bool _littleEndian;

private List<TigerRecord> _files;

public TigerArchive(string path, bool littleEndian = true)
public TigerArchive(string path, TextureFormat platform, bool littleEndian = true)
: base(path)
{
_file = path;
_platform = platform;
_littleEndian = littleEndian;

_files = new List<TigerRecord>();
Expand Down Expand Up @@ -48,7 +50,8 @@ public override void Open()
var numRecords = reader.ReadUInt32();

// skip 4 bytes, or 8 in version 5 or later
reader.BaseStream.Position += version < 5 ? 4 : 8;
// also dont skip on PS4 since some idiot at CD or Eidos decided this field does not exist on PS4
reader.BaseStream.Position += version >= 5 && _platform != TextureFormat.Orbis ? 8 : 4;

// skip over config name
reader.BaseStream.Position += 32;
Expand Down
2 changes: 1 addition & 1 deletion Yura/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void OpenBigfile(string bigfile, IFileSettings settings)
_bigfile = new DefianceArchive(bigfile, settings.TextureFormat, _littleEndian);
break;
case Game.Tiger:
_bigfile = new TigerArchive(bigfile, _littleEndian);
_bigfile = new TigerArchive(bigfile, settings.TextureFormat, _littleEndian);
break;
default:
MessageBox.Show(this, Properties.Resources.NoGameSelectedMessage, Properties.Resources.NoGameSelected, MessageBoxButton.OK, MessageBoxImage.Exclamation);
Expand Down
5 changes: 5 additions & 0 deletions Yura/OpenDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@
<ComboBox Name="TextureFormatSelect" Grid.Column="1" Grid.Row="3">
<ComboBoxItem IsSelected="True">PC</ComboBoxItem>
<ComboBoxItem>PS2</ComboBoxItem>
<ComboBoxItem>PSP</ComboBoxItem>
<ComboBoxItem>PS3</ComboBoxItem>
<ComboBoxItem>PS4</ComboBoxItem>
<ComboBoxItem>Xbox</ComboBoxItem>
<ComboBoxItem>Xbox 360</ComboBoxItem>
<ComboBoxItem>Xbox One</ComboBoxItem>
<ComboBoxItem>Xbox Series X</ComboBoxItem>
<ComboBoxItem>Wii</ComboBoxItem>
</ComboBox>

Expand Down
15 changes: 12 additions & 3 deletions Yura/OpenDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ public TextureFormat TextureFormat
{
get
{
var format = (TextureFormatSelect.SelectedItem as ComboBoxItem).Content.ToString();

return (TextureFormat)Enum.Parse(typeof(TextureFormat), format, true);
return (TextureFormat)TextureFormatSelect.SelectedIndex;
}
}

Expand All @@ -104,9 +102,20 @@ private void GameSelect_SelectionChanged(object sender, SelectionChangedEventArg
public enum TextureFormat
{
Pc,

// PlayStation
Ps2,
Psp,
Ps3,
Orbis,

// Xbox
Xbox,
Xenon,
Durango,
Scarlett,

// Nintendo
Wii
}

Expand Down

0 comments on commit 402ace4

Please sign in to comment.