From cb1cf489f96b09872f8a9db41226c6f5d1654575 Mon Sep 17 00:00:00 2001
From: Starlet <gpyron@mail.com>
Date: Fri, 25 May 2018 17:33:09 -0400
Subject: [PATCH] [IApplicationFunctions/INvDrvServices] Stub
 GetPseudoDeviceId, FinishInitialize and add more pctl service names. (#127)

* [INvDrvServices] Stub FinishInitialize

* [IApplicationFunctions] Stub GetPseudoDeviceId

* I need to proofread my shit...

* Also add more pctl service names
---
 .../Services/Am/IApplicationFunctions.cs      | 15 +++++++++++--
 .../OsHle/Services/Nv/INvDrvServices.cs       | 22 +++++++++++++------
 Ryujinx.Core/OsHle/Services/ServiceFactory.cs | 11 +++++++++-
 3 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs b/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs
index 47152cd90..73ec7fac3 100644
--- a/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs
+++ b/Ryujinx.Core/OsHle/Services/Am/IApplicationFunctions.cs
@@ -20,7 +20,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
                 { 21, GetDesiredLanguage },
                 { 22, SetTerminateResult },
                 { 23, GetDisplayVersion  },
-                { 40, NotifyRunning      }
+                { 40, NotifyRunning      },
+                { 50, GetPseudoDeviceId  }
             };
         }
 
@@ -88,6 +89,16 @@ namespace Ryujinx.Core.OsHle.Services.Am
             return 0;
         }
 
+        public long GetPseudoDeviceId(ServiceCtx Context)
+        {
+            Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
+            
+            Context.ResponseData.Write(0L);
+            Context.ResponseData.Write(0L);
+
+            return 0;
+        }
+
         private byte[] MakeLaunchParams()
         {
             //Size needs to be at least 0x88 bytes otherwise application errors.
@@ -106,4 +117,4 @@ namespace Ryujinx.Core.OsHle.Services.Am
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs
index 00209f9db..aead6e04c 100644
--- a/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs
+++ b/Ryujinx.Core/OsHle/Services/Nv/INvDrvServices.cs
@@ -38,12 +38,13 @@ namespace Ryujinx.Core.OsHle.Services.Nv
         {
             m_Commands = new Dictionary<int, ServiceProcessRequest>()
             {
-                { 0, Open         },
-                { 1, Ioctl        },
-                { 2, Close        },
-                { 3, Initialize   },
-                { 4, QueryEvent   },
-                { 8, SetClientPid }
+                { 0,  Open             },
+                { 1,  Ioctl            },
+                { 2,  Close            },
+                { 3,  Initialize       },
+                { 4,  QueryEvent       },
+                { 8,  SetClientPid     },
+                { 13, FinishInitialize }
             };
 
             Event = new KEvent();
@@ -138,6 +139,13 @@ namespace Ryujinx.Core.OsHle.Services.Nv
 
             return 0;
         }
+        
+        public long FinishInitialize(ServiceCtx Context)
+        {
+            Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
+
+            return 0;
+        }
 
         private static int ProcessIoctlNvGpuAS(ServiceCtx Context, int Cmd)
         {
@@ -217,4 +225,4 @@ namespace Ryujinx.Core.OsHle.Services.Nv
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs
index 6b636e0fd..07dde173e 100644
--- a/Ryujinx.Core/OsHle/Services/ServiceFactory.cs
+++ b/Ryujinx.Core/OsHle/Services/ServiceFactory.cs
@@ -97,9 +97,18 @@ namespace Ryujinx.Core.OsHle.Services
                 case "nvdrv:a":
                     return new INvDrvServices();
 
+                case "pctl:s":
+                    return new IParentalControlServiceFactory();
+
+                case "pctl:r":
+                    return new IParentalControlServiceFactory();
+
                 case "pctl:a":
                     return new IParentalControlServiceFactory();
 
+                case "pctl":
+                    return new IParentalControlServiceFactory();
+
                 case "pl:u":
                     return new ISharedFontManager();
 
@@ -146,4 +155,4 @@ namespace Ryujinx.Core.OsHle.Services
             throw new NotImplementedException(Name);
         }
     }
-}
\ No newline at end of file
+}