add more parameters to initialize device

This commit is contained in:
Emmanuel Hansen 2023-07-05 18:59:21 +00:00
parent bb3aed5b4a
commit a661494aae
3 changed files with 65 additions and 16 deletions

View File

@ -21,6 +21,7 @@ using Microsoft.Win32.SafeHandles;
using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using LibHac.Tools.Fs;
using Ryujinx.HLE.HOS.SystemState;
namespace LibRyujinx
{
@ -90,9 +91,29 @@ namespace LibRyujinx
}
[UnmanagedCallersOnly(EntryPoint = "Java_org_ryujinx_android_RyujinxNative_deviceInitialize")]
public static JBoolean JniInitializeDeviceNative(JEnvRef jEnv, JObjectLocalRef jObj, JBoolean isHostMapped, JBoolean useNce)
public static JBoolean JniInitializeDeviceNative(JEnvRef jEnv,
JObjectLocalRef jObj,
JBoolean isHostMapped,
JBoolean useNce,
JInt systemLanguage,
JInt regionCode,
JBoolean enableVsync,
JBoolean enableDockedMode,
JBoolean enablePtc,
JBoolean enableInternetAccess,
JStringLocalRef timeZone,
JBoolean ignoreMissingServices)
{
return InitializeDevice(isHostMapped, useNce);
return InitializeDevice(isHostMapped,
useNce,
(SystemLanguage)(int)systemLanguage,
(RegionCode)(int)regionCode,
enableVsync,
enableDockedMode,
enablePtc,
enableInternetAccess,
GetString(jEnv, timeZone),
ignoreMissingServices);
}
[UnmanagedCallersOnly(EntryPoint = "Java_org_ryujinx_android_RyujinxNative_deviceGetGameStats")]

View File

@ -1,5 +1,6 @@
using ARMeilleure.Translation;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.SystemState;
using System;
using System.Collections.Generic;
using System.IO;
@ -15,17 +16,35 @@ namespace LibRyujinx
[UnmanagedCallersOnly(EntryPoint = "device_initialize")]
public static bool InitializeDeviceNative()
{
return InitializeDevice(true, false);
return InitializeDevice(true, false, SystemLanguage.AmericanEnglish, RegionCode.USA, true, true, true, false, "UTC", false);
}
public static bool InitializeDevice(bool isHostMapped, bool useNce)
public static bool InitializeDevice(bool isHostMapped,
bool useNce,
SystemLanguage systemLanguage,
RegionCode regionCode,
bool enableVsync,
bool enableDockedMode,
bool enablePtc,
bool enableInternetAccess,
string timeZone,
bool ignoreMissingServices)
{
if (SwitchDevice == null)
{
return false;
}
return SwitchDevice.InitializeContext(isHostMapped, useNce);
return SwitchDevice.InitializeContext(isHostMapped,
useNce,
systemLanguage,
regionCode,
enableVsync,
enableDockedMode,
enablePtc,
enableInternetAccess,
timeZone,
ignoreMissingServices);
}
[UnmanagedCallersOnly(EntryPoint = "device_load")]

View File

@ -538,9 +538,18 @@ namespace LibRyujinx
UserChannelPersistence = new UserChannelPersistence();
}
public bool InitializeContext(bool isHostMapped, bool useNce)
public bool InitializeContext(bool isHostMapped,
bool useNce,
SystemLanguage systemLanguage,
RegionCode regionCode,
bool enableVsync,
bool enableDockedMode,
bool enablePtc,
bool enableInternetAccess,
string timeZone,
bool ignoreMissingServices)
{
if(LibRyujinx.Renderer == null)
if (LibRyujinx.Renderer == null)
{
return false;
}
@ -564,21 +573,21 @@ namespace LibRyujinx
LibRyujinx.AudioDriver, //Audio
MemoryConfiguration.MemoryConfiguration4GiB,
null,
SystemLanguage.AmericanEnglish,
RegionCode.USA,
true,
true,
true,
false,
systemLanguage,
regionCode,
enableVsync,
enableDockedMode,
enablePtc,
enableInternetAccess,
IntegrityCheckLevel.None,
0,
0,
"UTC",
timeZone,
isHostMapped ? MemoryManagerMode.HostMappedUnsafe : MemoryManagerMode.SoftwarePageTable,
false,
ignoreMissingServices,
LibRyujinx.GraphicsConfiguration.AspectRatio,
100,
true,
useNce,
"");
EmulationContext = new Switch(configuration);