AmIApplicationFunctions.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.IO;
  2. using static Ryujinx.OsHle.Objects.ObjHelper;
  3. namespace Ryujinx.OsHle.Objects
  4. {
  5. class AmIApplicationFunctions
  6. {
  7. private const uint LaunchParamsMagic = 0xc79497ca;
  8. public static long PopLaunchParameter(ServiceCtx Context)
  9. {
  10. //Only the first 0x18 bytes of the Data seems to be actually used.
  11. MakeObject(Context, new AmIStorage(MakeLaunchParams()));
  12. return 0;
  13. }
  14. public static long EnsureSaveData(ServiceCtx Context)
  15. {
  16. long UIdLow = Context.RequestData.ReadInt64();
  17. long UIdHigh = Context.RequestData.ReadInt64();
  18. Context.ResponseData.Write(0L);
  19. return 0;
  20. }
  21. public static long GetDesiredLanguage(ServiceCtx Context)
  22. {
  23. //This is an enumerator where each number is a differnet language.
  24. //0 is Japanese and 1 is English, need to figure out the other codes.
  25. Context.ResponseData.Write(1L);
  26. return 0;
  27. }
  28. private static byte[] MakeLaunchParams()
  29. {
  30. //Size needs to be at least 0x88 bytes otherwise application errors.
  31. using (MemoryStream MS = new MemoryStream())
  32. {
  33. BinaryWriter Writer = new BinaryWriter(MS);
  34. MS.SetLength(0x88);
  35. Writer.Write(LaunchParamsMagic);
  36. Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
  37. Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
  38. Writer.Write(0L); //User Id High
  39. return MS.ToArray();
  40. }
  41. }
  42. }
  43. }