Compliant with review.

This commit is contained in:
Starlet 2018-07-03 17:56:27 -04:00
commit fb27eb5d1e

View file

@ -10,7 +10,7 @@ namespace Ryujinx.HLE.OsHle.Services.Spl
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
private RNGCryptoServiceProvider CspRnd; private RNGCryptoServiceProvider Rng;
public IRandomInterface() public IRandomInterface()
{ {
@ -19,18 +19,16 @@ namespace Ryujinx.HLE.OsHle.Services.Spl
{ 0, GetRandomBytes } { 0, GetRandomBytes }
}; };
CspRnd = new RNGCryptoServiceProvider(); Rng = new RNGCryptoServiceProvider();
} }
public long GetRandomBytes(ServiceCtx Context) public long GetRandomBytes(ServiceCtx Context)
{ {
(long Position, long Size) = Context.Request.GetBufferType0x21(); byte[] RandomBytes = new byte[Context.Request.ReceiveBuff[0].Size];
byte[] BytesBuffer = new byte[Size]; Rng.GetBytes(RandomBytes);
CspRnd.GetBytes(BytesBuffer); Context.Memory.WriteBytes(Context.Request.ReceiveBuff[0].Position, RandomBytes);
Context.Memory.WriteBytes(Position, BytesBuffer);
return 0; return 0;
} }