Implement GetRegionCode and add the RegionCode to settings (#999)

This implement `GetRegionCode` accordingly to RE. I've added a setting in the GUI and a field in the Configuration file with a way to update the Configuration file if needed.
This commit is contained in:
Ac_K 2020-03-19 23:37:55 +01:00 committed by GitHub
parent 561d64e5bf
commit 32d3f3f690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 156 additions and 6 deletions

View file

@ -54,6 +54,24 @@ namespace Ryujinx.HLE.HOS.Services.Settings
return ResultCode.Success;
}
[Command(4)]
// GetRegionCode() -> u32 nn::settings::RegionCode
public ResultCode GetRegionCode(ServiceCtx context)
{
// NOTE: Service mount 0x8000000000000050 savedata and read the region code here.
SystemRegion regionCode = (SystemRegion)context.Device.System.State.DesiredRegionCode;
if (regionCode < SystemRegion.Min || regionCode > SystemRegion.Max)
{
regionCode = SystemRegion.USA;
}
context.ResponseData.Write((uint)regionCode);
return ResultCode.Success;
}
[Command(5)]
// GetAvailableLanguageCodes2() -> (u32, buffer<nn::settings::LanguageCode, 6>)
public ResultCode GetAvailableLanguageCodes2(ServiceCtx context)

View file

@ -0,0 +1,16 @@
namespace Ryujinx.HLE.HOS.SystemState
{
public enum SystemRegion
{
Japan,
USA,
Europe,
Australia,
China,
Korea,
Taiwan,
Min = Japan,
Max = Taiwan
}
}

View file

@ -37,6 +37,8 @@ namespace Ryujinx.HLE.HOS.SystemState
internal long DesiredLanguageCode { get; private set; }
internal uint DesiredRegionCode { get; private set; }
public TitleLanguage DesiredTitleLanguage { get; private set; }
internal string ActiveAudioOutput { get; private set; }
@ -79,6 +81,11 @@ namespace Ryujinx.HLE.HOS.SystemState
}
}
public void SetRegion(SystemRegion region)
{
DesiredRegionCode = (uint)region;
}
public void SetAudioOutputAsTv()
{
ActiveAudioOutput = AudioOutputs[0];