Skip to content

Commit

Permalink
Check if _applicationData.ControlHolder.ByteSpan is zeros only once
Browse files Browse the repository at this point in the history
  • Loading branch information
TSRBerry committed Jul 16, 2024
1 parent 025fa82 commit 7dd7fc5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Ryujinx.Gtk3/UI/Widgets/GameTableContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ public GameTableContextMenu(MainWindow parent, VirtualFileSystem virtualFileSyst
_horizonClient = horizonClient;
_applicationData = applicationData;

_openSaveUserDirMenuItem.Sensitive = !Utilities.IsZeros(_applicationData.ControlHolder.ByteSpan) && _applicationData.ControlHolder.Value.UserAccountSaveDataSize > 0;
_openSaveDeviceDirMenuItem.Sensitive = !Utilities.IsZeros(_applicationData.ControlHolder.ByteSpan) && _applicationData.ControlHolder.Value.DeviceSaveDataSize > 0;
_openSaveBcatDirMenuItem.Sensitive = !Utilities.IsZeros(_applicationData.ControlHolder.ByteSpan) && _applicationData.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
if (!_applicationData.ControlHolder.ByteSpan.IsZeros())
{
_openSaveUserDirMenuItem.Sensitive = _applicationData.ControlHolder.Value.UserAccountSaveDataSize > 0;
_openSaveDeviceDirMenuItem.Sensitive = _applicationData.ControlHolder.Value.DeviceSaveDataSize > 0;
_openSaveBcatDirMenuItem.Sensitive = _applicationData.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
}
else
{
_openSaveUserDirMenuItem.Sensitive = false;
_openSaveDeviceDirMenuItem.Sensitive = false;
_openSaveBcatDirMenuItem.Sensitive = false;
}

string fileExt = System.IO.Path.GetExtension(_applicationData.Path).ToLower();
bool hasNca = fileExt == ".nca" || fileExt == ".nsp" || fileExt == ".pfs0" || fileExt == ".xci";
Expand Down

0 comments on commit 7dd7fc5

Please sign in to comment.