Horizon: Impl Prepo, Fixes bugs, Clean things (#4220)
* Horizon: Impl Prepo, Fixes bugs, Clean things * remove ToArray() * resultCode > status * Remove old services * Addresses gdkchan's comments and more cleanup * Addresses Gdkchan's feedback 2 * Reorganize services, make sure service are loaded before guest Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com> * Create interfaces for lm and sm Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
This commit is contained in:
parent
3ffceab1fb
commit
550747eac6
83 changed files with 1106 additions and 880 deletions
|
@ -75,9 +75,10 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
}
|
||||
|
||||
session.PointerBuffer = GetSessionPointerBuffer(session);
|
||||
session.SavedMessage = GetSessionSavedMessageBuffer(session);
|
||||
session.SavedMessage = GetSessionSavedMessageBuffer(session);
|
||||
|
||||
RegisterSessionToWaitList(session);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -109,10 +110,10 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
}
|
||||
|
||||
protected virtual Server AllocateServer(
|
||||
int portIndex,
|
||||
int portHandle,
|
||||
ServiceName name,
|
||||
bool managed,
|
||||
int portIndex,
|
||||
int portHandle,
|
||||
ServiceName name,
|
||||
bool managed,
|
||||
ServiceObjectHolder staticHoder)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
|
@ -141,6 +142,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
protected void CloseSessionImpl(ServerSession session)
|
||||
{
|
||||
int sessionHandle = session.Handle;
|
||||
|
||||
Os.FinalizeMultiWaitHolder(session);
|
||||
DestroySession(session);
|
||||
HorizonStatic.Syscall.CloseHandle(sessionHandle).AbortOnFailure();
|
||||
|
@ -156,6 +158,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
if (session.IsClosed || GetCmifCommandType(message) == CommandType.Close)
|
||||
{
|
||||
CloseSessionImpl(session);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
else
|
||||
|
@ -165,6 +168,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
if (result.IsSuccess)
|
||||
{
|
||||
RegisterSessionToWaitList(session);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
else if (SfResult.RequestContextChanged(result))
|
||||
|
@ -176,6 +180,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
Logger.Warning?.Print(LogClass.KernelIpc, $"Request processing returned error {result}");
|
||||
|
||||
CloseSessionImpl(session);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
||||
|
@ -197,8 +202,8 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
return DispatchManagerRequest(session, inMessage, outMessage);
|
||||
default:
|
||||
return HipcResult.UnknownCommandType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetInlineContext(CommandType commandType, ReadOnlySpan<byte> inMessage)
|
||||
{
|
||||
|
@ -231,7 +236,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
{
|
||||
HipcMessageData messageData = HipcMessage.WriteMessage(message, new HipcMetadata()
|
||||
{
|
||||
Type = (int)CommandType.Invalid,
|
||||
Type = (int)CommandType.Invalid,
|
||||
ReceiveStaticsCount = HipcMessage.AutoReceiveStatic
|
||||
});
|
||||
|
||||
|
@ -271,9 +276,9 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
|
||||
protected virtual Result DispatchRequest(
|
||||
ServiceObjectHolder objectHolder,
|
||||
ServerSession session,
|
||||
Span<byte> inMessage,
|
||||
Span<byte> outMessage)
|
||||
ServerSession session,
|
||||
Span<byte> inMessage,
|
||||
Span<byte> outMessage)
|
||||
{
|
||||
HipcMessage request;
|
||||
|
||||
|
@ -288,14 +293,14 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
|
||||
var dispatchCtx = new ServiceDispatchContext()
|
||||
{
|
||||
ServiceObject = objectHolder.ServiceObject,
|
||||
Manager = this,
|
||||
Session = session,
|
||||
HandlesToClose = new HandlesToClose(),
|
||||
PointerBuffer = session.PointerBuffer,
|
||||
InMessageBuffer = inMessage,
|
||||
ServiceObject = objectHolder.ServiceObject,
|
||||
Manager = this,
|
||||
Session = session,
|
||||
HandlesToClose = new HandlesToClose(),
|
||||
PointerBuffer = session.PointerBuffer,
|
||||
InMessageBuffer = inMessage,
|
||||
OutMessageBuffer = outMessage,
|
||||
Request = request
|
||||
Request = request
|
||||
};
|
||||
|
||||
ReadOnlySpan<byte> inRawData = MemoryMarshal.Cast<uint, byte>(dispatchCtx.Request.Data.DataWords);
|
||||
|
@ -332,4 +337,4 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
|||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue