[video] Add game title to window

This commit is contained in:
ParantezTech
2026-06-21 23:19:16 +03:00
parent 464422f23e
commit dad85b87c3
3 changed files with 32 additions and 11 deletions
+13 -1
View File
@@ -21,7 +21,10 @@ public sealed class SelfImage
IReadOnlyList<ulong>? initializerFunctions = null,
ulong initFunctionEntryPoint = 0,
ulong imageBase = 0,
ulong procParamAddress = 0)
ulong procParamAddress = 0,
string? title = null,
string? titleId = null,
string? version = null)
{
ArgumentNullException.ThrowIfNull(programHeaders);
ArgumentNullException.ThrowIfNull(mappedRegions);
@@ -38,6 +41,9 @@ public sealed class SelfImage
InitFunctionEntryPoint = initFunctionEntryPoint;
_imageBase = imageBase;
ProcParamAddress = procParamAddress;
Title = title;
TitleId = titleId;
Version = version;
}
public bool IsSelf { get; }
@@ -63,4 +69,10 @@ public sealed class SelfImage
public ulong EntryPoint => ElfHeader.EntryPoint + _imageBase;
public ulong ProcParamAddress { get; }
public string? Title { get; }
public string? TitleId { get; }
public string? Version { get; }
}
+18 -10
View File
@@ -144,10 +144,9 @@ public sealed class SelfLoader : ISelfLoader
throw new InvalidDataException("Input image is empty.");
}
if (readParamJson)
{
TryLoadParamJson(fs, mountRoot);
}
var applicationInfo = readParamJson
? TryLoadParamJson(fs, mountRoot)
: default;
if (clearVirtualMemory)
{
@@ -270,15 +269,20 @@ public sealed class SelfLoader : ISelfLoader
initializerFunctions,
initFunctionEntryPoint,
imageBase,
procParamAddress);
procParamAddress,
applicationInfo.Title,
applicationInfo.TitleId,
applicationInfo.Version);
}
private static void TryLoadParamJson(IFileSystem? fs, string? mountRoot)
private static (string? Title, string? TitleId, string? Version) TryLoadParamJson(
IFileSystem? fs,
string? mountRoot)
{
if (fs == null)
{
Console.WriteLine("[LOADER] param.json not found (no filesystem provided).");
return;
return default;
}
string[] possiblePaths = string.IsNullOrEmpty(mountRoot)
@@ -298,12 +302,16 @@ public sealed class SelfLoader : ISelfLoader
if (foundPath == null)
{
Console.WriteLine("[LOADER] param.json not found (no root path / unknown layout).");
return;
return default;
}
var (title, titleId, ver) = Ps5ParamJsonReader.TryReadPs5Param(fs, foundPath);
var applicationInfo = Ps5ParamJsonReader.TryReadPs5Param(fs, foundPath);
Console.WriteLine($"[LOADER] Loading param.json at {foundPath}");
Console.WriteLine($"[LOADER] Title: {title ?? "(unknown)"}, TitleId: {titleId ?? "(unknown)"}, Version: {ver ?? "(unknown)"}");
Console.WriteLine(
$"[LOADER] Title: {applicationInfo.Title ?? "(unknown)"}, " +
$"TitleId: {applicationInfo.TitleId ?? "(unknown)"}, " +
$"Version: {applicationInfo.Version ?? "(unknown)"}");
return applicationInfo;
}
private static LoadContext ParseLayout(ReadOnlySpan<byte> imageData)
@@ -135,6 +135,7 @@ public sealed class SharpEmuRuntime : ISharpEmuRuntime
LastMilestoneLog = null;
KernelModuleRegistry.Reset();
var image = LoadImage(normalizedEbootPath);
VideoOutExports.ConfigureApplicationInfo(image.Title, image.TitleId, image.Version);
RegisterLoadedModule(normalizedEbootPath, image, isMain: true, isSystemModule: false);
KernelRuntimeCompatExports.ConfigureProcessProcParamAddress(image.ProcParamAddress);
Console.Error.WriteLine($"[RUNTIME] Entry: 0x{image.EntryPoint:X16}");