2018-02-04 15:08:20 -08:00
|
|
|
using ChocolArm64.Memory;
|
2018-02-24 20:34:16 -08:00
|
|
|
using Ryujinx.Core.OsHle.Ipc;
|
2018-02-27 19:31:52 -08:00
|
|
|
using System;
|
2018-02-24 20:34:16 -08:00
|
|
|
using System.Collections.Generic;
|
2018-02-04 15:08:20 -08:00
|
|
|
|
2018-03-20 13:00:00 -07:00
|
|
|
namespace Ryujinx.Core.OsHle.Services.Set
|
2018-02-04 15:08:20 -08:00
|
|
|
{
|
2018-03-19 11:58:46 -07:00
|
|
|
class ServiceSet : IpcService
|
2018-02-04 15:08:20 -08:00
|
|
|
{
|
2018-02-24 20:34:16 -08:00
|
|
|
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
|
|
|
|
2018-03-19 11:58:46 -07:00
|
|
|
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
2018-02-24 20:34:16 -08:00
|
|
|
|
|
|
|
public ServiceSet()
|
|
|
|
{
|
|
|
|
m_Commands = new Dictionary<int, ServiceProcessRequest>()
|
|
|
|
{
|
2018-03-23 03:42:34 -07:00
|
|
|
{ 1, GetAvailableLanguageCodes },
|
|
|
|
{ 3, GetAvailableLanguageCodeCount }
|
2018-02-24 20:34:16 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-04 15:08:20 -08:00
|
|
|
private const int LangCodesCount = 13;
|
|
|
|
|
2018-02-24 20:34:16 -08:00
|
|
|
public static long GetAvailableLanguageCodes(ServiceCtx Context)
|
2018-02-04 15:08:20 -08:00
|
|
|
{
|
|
|
|
int PtrBuffSize = Context.RequestData.ReadInt32();
|
|
|
|
|
|
|
|
if (Context.Request.RecvListBuff.Count > 0)
|
|
|
|
{
|
|
|
|
long Position = Context.Request.RecvListBuff[0].Position;
|
|
|
|
short Size = Context.Request.RecvListBuff[0].Size;
|
|
|
|
|
|
|
|
//This should return an array of ints with values matching the LanguageCode enum.
|
2018-02-27 19:31:52 -08:00
|
|
|
foreach (long value in new long[] { 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L })
|
|
|
|
{
|
|
|
|
AMemoryHelper.WriteBytes(Context.Memory, Position += 8, BitConverter.GetBytes(value));
|
|
|
|
}
|
2018-02-04 15:08:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Context.ResponseData.Write(LangCodesCount);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2018-03-23 03:42:34 -07:00
|
|
|
|
|
|
|
public static long GetAvailableLanguageCodeCount(ServiceCtx Context)
|
|
|
|
{
|
|
|
|
Context.ResponseData.Write(LangCodesCount);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2018-02-04 15:08:20 -08:00
|
|
|
}
|
|
|
|
}
|