Skip to content

Commit

Permalink
misc: chore: cleanup AppletMetadata.CanStart
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Jan 10, 2025
1 parent 27993b7 commit 845c86f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/Ryujinx/Utilities/AppletMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,27 @@ public AppletMetadata(string name, ulong programId, string version = "1.0.0")

public string GetContentPath(ContentManager contentManager)
=> (contentManager ?? _contentManager)
.GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program);
?.GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program);

public bool CanStart(ContentManager contentManager, out ApplicationData appData,
out BlitStruct<ApplicationControlProperty> appControl)
{
contentManager ??= _contentManager;
if (contentManager == null)
{
appData = null;
appControl = new BlitStruct<ApplicationControlProperty>(0);
return false;
}
if (contentManager == null)
goto BadData;

appData = new() { Name = Name, Id = ProgramId, Path = GetContentPath(contentManager) };

if (string.IsNullOrEmpty(appData.Path))
{
appControl = new BlitStruct<ApplicationControlProperty>(0);
return false;
}
string contentPath = GetContentPath(contentManager);
if (string.IsNullOrEmpty(contentPath))
goto BadData;

appData = new() { Name = Name, Id = ProgramId, Path = GetContentPath(contentManager) };
appControl = StructHelpers.CreateCustomNacpData(Name, Version);
return true;

BadData:
appData = null;
appControl = new BlitStruct<ApplicationControlProperty>(0);
return false;
}
}
}

0 comments on commit 845c86f

Please sign in to comment.