mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-14 12:56:14 +08:00
[video] hide splash
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
using SharpEmu.HLE;
|
||||
using SharpEmu.Libs.VideoOut;
|
||||
using System.Buffers.Binary;
|
||||
|
||||
namespace SharpEmu.Libs.SystemService;
|
||||
@@ -85,6 +86,17 @@ public static class SystemServiceExports
|
||||
: SetReturn(ctx, (int)OrbisGen2Result.ORBIS_GEN2_ERROR_MEMORY_FAULT);
|
||||
}
|
||||
|
||||
[SysAbiExport(
|
||||
Nid = "Vo5V8KAwCmk",
|
||||
ExportName = "sceSystemServiceHideSplashScreen",
|
||||
Target = Generation.Gen4 | Generation.Gen5,
|
||||
LibraryName = "libSceSystemService")]
|
||||
public static int SystemServiceHideSplashScreen(CpuContext ctx)
|
||||
{
|
||||
VulkanVideoPresenter.HideSplashScreen();
|
||||
return SetReturn(ctx, 0);
|
||||
}
|
||||
|
||||
private static int SetReturn(CpuContext ctx, int result)
|
||||
{
|
||||
ctx[CpuRegister.Rax] = unchecked((ulong)result);
|
||||
|
||||
@@ -88,6 +88,28 @@ internal static unsafe class VulkanVideoPresenter
|
||||
}
|
||||
}
|
||||
|
||||
public static void HideSplashScreen()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
_splashHidden = true;
|
||||
if (_closed || _latestPresentation is not { IsSplash: true } latest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sequence = latest.Sequence + 1;
|
||||
_latestPresentation = new Presentation(
|
||||
CreateBlackFrame(latest.Width, latest.Height),
|
||||
latest.Width,
|
||||
latest.Height,
|
||||
sequence,
|
||||
GuestDrawKind.None,
|
||||
IsSplash: false);
|
||||
Console.Error.WriteLine("[LOADER][INFO] Vulkan VideoOut hid splash");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Submit(byte[] bgraFrame, uint width, uint height)
|
||||
{
|
||||
if (bgraFrame.Length != checked((int)(width * height * 4)))
|
||||
@@ -168,6 +190,24 @@ internal static unsafe class VulkanVideoPresenter
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] CreateBlackFrame(uint width, uint height)
|
||||
{
|
||||
if (width == 0 || height == 0 || width > 8192 || height > 8192)
|
||||
{
|
||||
width = 1;
|
||||
height = 1;
|
||||
}
|
||||
|
||||
var pixels = GC.AllocateUninitializedArray<byte>(checked((int)(width * height * 4)));
|
||||
pixels.AsSpan().Clear();
|
||||
for (var offset = 3; offset < pixels.Length; offset += 4)
|
||||
{
|
||||
pixels[offset] = 0xFF;
|
||||
}
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
private static void Run()
|
||||
{
|
||||
uint width;
|
||||
|
||||
Reference in New Issue
Block a user