mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 03:16:23 +02:00
Add title update functionality
This commit is contained in:
parent
27312d4f31
commit
7277e1fa9b
5 changed files with 71 additions and 6 deletions
|
@ -115,6 +115,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
private static bool _enableMouse;
|
||||
|
||||
private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
private static readonly TitleUpdateMetadataJsonSerializerContext _titleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "main_ryujinx_sdl")]
|
||||
public static unsafe int MainExternal(int argCount, IntPtr* pArgs)
|
||||
|
@ -141,6 +142,20 @@ namespace Ryujinx.Headless.SDL2
|
|||
return 0;
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "set_title_update")]
|
||||
public static unsafe void SetTitleUpdate(IntPtr titleIdPtr, IntPtr updatePathPtr) {
|
||||
var titleId = Marshal.PtrToStringAnsi(titleIdPtr);
|
||||
var updatePath = Marshal.PtrToStringAnsi(updatePathPtr);
|
||||
string _updateJsonPath = System.IO.Path.Combine(AppDataManager.GamesDirPath, titleId, "updates.json");
|
||||
|
||||
TitleUpdateMetadata _titleUpdateWindowData = new TitleUpdateMetadata
|
||||
{
|
||||
Selected = updatePath,
|
||||
Paths = new List<string>(),
|
||||
};
|
||||
JsonHelper.SerializeToFile(_updateJsonPath, _titleUpdateWindowData, _titleSerializerContext.TitleUpdateMetadata);
|
||||
}
|
||||
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "get_current_fps")]
|
||||
public static unsafe int GetFPS()
|
||||
|
@ -722,7 +737,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
if (File.Exists(titleUpdateMetadataPath))
|
||||
{
|
||||
// updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath).Selected;
|
||||
updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath, _titleSerializerContext.TitleUpdateMetadata).Selected;
|
||||
|
||||
if (File.Exists(updatePath))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue