am: Return IStorage not available when queue is empty

We should be returning the appropriate error code when the FIFO is empty, rather than just throwing an exception and killing the emulator.
This commit is contained in:
jduncanator 2019-11-18 14:32:15 +11:00
parent 99386091c0
commit 8917ab42c5
3 changed files with 16 additions and 9 deletions

View file

@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Applets
}
// If our default text is longer than the allowed length,
// we trunacte it.
// we truncate it.
if (_textValue.Length > _keyboardConfig.StringLengthMax)
{
_textValue = _textValue.Substring(0, (int)_keyboardConfig.StringLengthMax);

View file

@ -95,13 +95,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// PopOutData() -> object<nn::am::service::IStorage>
public ResultCode PopOutData(ServiceCtx context)
{
byte[] data = _normalSession.Pop();
if(_normalSession.TryPop(out byte[] data))
{
MakeObject(context, new IStorage(data));
MakeObject(context, new IStorage(data));
_normalOutDataEvent.WritableEvent.Clear();
_normalOutDataEvent.WritableEvent.Clear();
return ResultCode.Success;
}
return ResultCode.Success;
return ResultCode.NotAvailble;
}
[Command(103)]
@ -119,13 +122,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Lib
// PopInteractiveOutData() -> object<nn::am::service::IStorage>
public ResultCode PopInteractiveOutData(ServiceCtx context)
{
byte[] data = _interactiveSession.Pop();
if(_interactiveSession.TryPop(out byte[] data))
{
MakeObject(context, new IStorage(data));
MakeObject(context, new IStorage(data));
_interactiveOutDataEvent.WritableEvent.Clear();
_interactiveOutDataEvent.WritableEvent.Clear();
return ResultCode.Success;
}
return ResultCode.Success;
return ResultCode.NotAvailble;
}
[Command(105)]

View file

@ -7,6 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
Success = 0,
NotAvailble = (2 << ErrorCodeShift) | ModuleId,
NoMessages = (3 << ErrorCodeShift) | ModuleId,
ObjectInvalid = (500 << ErrorCodeShift) | ModuleId,
OutOfBounds = (503 << ErrorCodeShift) | ModuleId,